Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get array/list of entities from Doctrine

This is probably pretty simple, but I can't find a way to do this.

Is there any way to get a list of class names of the entities that Doctrine manages? Something like:

$entities = $doctrine->em->getEntities();

where $entities is an array with something like array('User', 'Address', 'PhoneNumber') etc...

like image 797
celestialorb Avatar asked Feb 22 '13 19:02

celestialorb


1 Answers

Another way to get the class names of all entities (with namespace) is:

$entitiesClassNames = $entityManager->getConfiguration()->getMetadataDriverImpl()->getAllClassNames();
like image 88
Hubert Dziubiński Avatar answered Oct 11 '22 00:10

Hubert Dziubiński