-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Fill in reference document about overriding each part of a bundle #735
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I've made some progress on this issue (as you can see, each section is short, and just points elsewhere), but there are several other areas that we can still cover. Many of those are sitting in the document and are waiting for your contribution :) |
If I may I would like to ping you guys regarding the "Entities & Entity mapping" section in that document. Got lots and lots of questions about this - it doesn't seem to be covered in the documentation, and in the IRC channel I get confusing and contradicting suggestions about it. |
Related PR: #2333 |
Doctrine added support to override attributes and so on in one of the latest version. Maybe we can use that? |
Doctrine 2.3.x is used since Symfony 2.1, so we can use it. |
AttributeOverride can be used to overwrite the mapping of an inherited field. So it makes it easier when a bundle provides a mapped superclass. |
That's right, but do you think that's a reason not to mention the already existing possibilities? Even if it's only one sentence like
and link it to the Doctrine documentation. |
@xabbuh I'm 👍 for that, not finished documentation is worse. |
@xabbuh sure it can be mentionned, but not as a way to overwrite entities |
Hello everybody, |
I didn't look at the Sympatch bundle yet, but if it can be the solution for overriden bundle parts, I'm 👍 for it. I think including relevant and great bundles in the documentation is a usefull evolution. |
This bundle is a hack IMO. It modifies the content of the vendor bundles, which does not play well with vendor updates |
@stof hack sounds negative. I don't consider myself a hacker :-) . Of course, my bundle's approach is much different from all other recommendations that deal with overriding foreign code. I gave a procedure for code base updates which consists in deactivate all patches, upgrade the code base and reactivate the patches, just 2 extra console commands (I believe that could be automated). Can I guarantee that after vendor updates everything will work? I can't. But chances are good that it will. |
If it is not possible to overwrite an entity. How is everyone using vendor bundles for projects? Eg, a blog. Sometimes you may need to add additional fields to a post entity or you may want to add a blog category introduction field. From what I understand, with the mapped super classes, it means you MUST create the sub classes in the app specific bundle. Also, this does not work for One-To-Many associations on the mapped super class so you couldn't setup a default structure for the blog with posts/categories? Is it not possible to somehow intercept the mappings with an event and just point the mapped at a different class if it exists? |
OneToMany Associations work fine with this method. Doctrine provides a ResolveTargetEntityListener that lets you define relationships against abstract classes or interfaces that can be overridden to point to a concrete implementation of an entity at runtime. |
Does anyone have a solution for the overriding of mapped entities yet? |
See the new entry introduced in sha: 8c97795
I think much of it will just be a reference (links to to other places), while some topics (because it's hard or impossible to override), should be discussed
The text was updated successfully, but these errors were encountered: