Reputation: 179
I have a two level entity folder in a Symfony2 bundle:
CommonBundle/Entity/EntityFolder1/EntityA.php
CommonBundle/Entity/EntityFolder2
CommonBundle/Entity/EntityFolder3
CommonBundle/Entity/EntityFolder4
When I try to get the repositories for an entity that is within one of the folders:
$product = $this->getDoctrine()->getRepository('CommonBundle:EntityA')->find(1);
Symfony doesn't recognize this CommonBundle:EntityA
.
I also tried with CommonBundle:EntityFolder1:EntityA
.
Warning: class_parents(): Class CommonBundle\Entity\EntityA does not exist and could not be loaded in
Upvotes: 11
Views: 3334
Reputation: 11351
Use the full class name of your entity:
$product = $this->getDoctrine()
->getRepository('Acme\CommonBundle\Entity\EntityFolder1\EntityA')
->find(1);
Upvotes: 1