问题
How can I resolve logical entity names to full class names in Symfony2? Like MyAcmeBundle:User
to My\AcmeBundle\Entity\User
.
回答1:
You can get the ClassMetadata from the EntityManager which will resolve the namespace into a fully qualified class name.
<?php
echo $manager->getClassMetadata('MyAcmeBundle:User')->getName();
来源:https://stackoverflow.com/questions/11406697/how-can-i-resolve-myacmebundleuser-to-my-acmebundle-entity-user-in-symfony2