Le 31/01/2011 23:43, Thomas Rabaix a écrit :
On 31 janv. 2011, at 23:24, Christophe COEVOET wrote:
Le 31/01/2011 23:12, Thomas Rabaix a écrit :
Hello,
Sorry to come that late but the last decision, about the Application namespace
removal, will be a failure [1]
A vendor published a bundle, now I need to extends a Model (not template
neither a resource). For now they is no solution to do so.
- model association definition does not work with resource declaration, ie :
BlogBundle:Post
- for retrieving the class name we need to use the entity manager => this
introduces a deep dependency
- how it is possible to access to constant ? or use a new constant ?
Symfony2 need a shared namespace for model definition. A bundle is not a black
box, a bunble need to be easily extendable, for now this not work for model.
[1]
https://github.com/symfony/symfony-sandbox/commit/fd9ed41a9b2c288fa455dcaee96a48bbbadb7314
Overriding the model of a bundle is not possible : the associations have to be
defined with the fully qualified class name so you cannot override the target
of an association.
Good argument for a global namespace ;)
Associations are defined by Doctrine, not by Symfony so it is logical that the
resource declaration does not work. It would make Doctrine depend to Symfony2
but it is not tied to Symfony2.
Another one
A shared namespace is not a solution either: this would mean that all model
classes have to be in the same directory (quite difficult to share bundles this
way) and that two bundles cannot define entities with the same name.
you can have :
- Application/FOS/UserBundle extends FOS/UserBundle
- Application/Sonata/BaseApplicationBundle extends
Sonata/BaseApplicationBundle
- Application/Sonata/GoutteBundle extends Sonata/GoutteBundle
And yes, your mapping definition will have a fully qualified namespace :
Application\FOS\UserBundle\Enity\User
this will not solve the issue.
This implies that all bundles defines their model by targetting an
extending class which does not exist in the bundle. Most of the time,
users will want to use the classes provided by the bundle. So this seems
to add much more complexity for both the bundle developpers and the
bundle users.
Thus, the way to extend a bundle is no more based on the namespace but
on the getParent() method of the bundle so why would this be made this
way for the model ?
--
Christophe | Stof
--
If you want to report a vulnerability issue on symfony, please send it to
security at symfony-project.com
You received this message because you are subscribed to the Google
Groups "symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en