Hello,

>From the documentation, it is possible to call an entity inside a doctrine 
>query with the shorthand notation : "MyBundle:Post"  [1]. Doctrine will look 
>inside the Application and the Bundle to find where the class is defined. This 
>point is very nice.

However this point also means, we need to ask a service to request the correct 
fully qualify namespace of an Entity (ie Application\MyBundle\Entity\Post or 
Bundle\MyBundle\Entity\Post ). For now the only solution I found is to use the 
entity manager : $em->getClassMetadata('MyBundle:Post')->name

So to instantiate a new Post object, we need to do something like : 

$class = $em->getClassMetadata('UrlShortenerBundle:Url')->name; 
$post = new $class;

This situation introduce a dependency to the entity manager for any class which 
need to instantiate an object (the class might not want to persist the object). 

what do you think ?


[1] http://docs.symfony-reloaded.org/guides/doctrine/orm/overview.html


-- 
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

Reply via email to