title: Zend Framework 2 - Doctrine - Iterate all entity classes
body: <p>Is there a good way to iterate all entity classes (across different modules) in Zend Framwork 2?</p>
  
  <p>I already tried to go by Doctrine's EntityManager:</p>
  
  <pre><code>$entityManager-&gt;getMetadataFactory()-&gt;getLoadedMetadata();
  </code></pre>
  
  <p>but that does only return an empty array.</p>
  
  <p>I know that one could probably do this by <a href="https://stackoverflow.com/questions/22761554/php-get-all-class-names-inside-a-particular-namespace">iterating all Classes in specific Namespaces</a>, but that seems like a lot of overhead.</p>
  
  <p>Is there maybe some way that I am missing?</p>