Skip to content
This repository has been archived by the owner on Nov 30, 2017. It is now read-only.

Fixed model class to be extended #340

Closed
wants to merge 1 commit into from
Closed

Fixed model class to be extended #340

wants to merge 1 commit into from

Conversation

herodrigues
Copy link
Contributor

Q A
Doc fix? yes
New docs? no
Fixed tickets #293

Custom models should extend core model class.

When trying to override Product model extending Sylius\Component\Product\Model\Product, it won't add all fields to the Product table in database.

  • Extending Sylius\Component\Product\Model\Product as written in the docs:
Column Type
id integer
archetype_id integer
available_on timestamp(0) without time zone
created_at timestamp(0) without time zone
updated_at timestamp(0) without time zone
deleted_at timestamp(0) without time zone
  • Extending Sylius\Component\Core\Model\Product (same table as the default installation):
Column Type
id integer
archetype_id integer
tax_category_id integer
shipping_category_id integer
restricted_zone integer
available_on timestamp(0) without time zone
created_at timestamp(0) without time zone
updated_at timestamp(0) without time zone
deleted_at timestamp(0) without time zone
variant_selection_method character varying(255)

Probably the same happens to the other models as related here #293

Custom models should extend core model class.
@herodrigues herodrigues changed the title Fixed model class to be overrided Fixed model class to be extended Oct 16, 2015
@pjedrzejewski
Copy link
Member

Thanks for raising this @herodrigues. Actually, I think we are missing overriding guide for main Sylius. This is "Bundles General Guide" and it applies to users of individual bundles. So it is currently correct to extend component models and not the ones from the core. We should add this documentation to the main part - The Book or maybe Cookbook. And perhaps clarify it in the general guide that it is only for using bundles standalone. What do you think about that?

@herodrigues
Copy link
Contributor Author

I'm developing a web system here where I work and I had to override some models. I'm not using individual bundles.
So, I'm not sure if this happens with other models.

Anyway, I think it's a good idea to clarify that in the documentation.
I had a lot work to do with Sylius here and I can start to write the documentation for main Sylius.

Should I close this PR and open one like "Overriding guide for main Sylius"?

@pjedrzejewski
Copy link
Member

@herodrigues I think it makes sense, but let's keep it in "The Book" section. Also, before you write any bigger chunk of docs, let's discuss it in a GitHub issues, maybe community will have some ideas and we can do it more efficiently with fewer iterations. :)

@herodrigues
Copy link
Contributor Author

Great! That's awesome!

Later, I'm gonna open a issue related to this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants