title: Programmatically load Entity in symfony
body: <p>I am trying to load in Entity classes and use within a loop in order to load content in dynamically from files into relating tables.</p>
  
  <p>Is there any way i can load in all Entity files from the following</p>
  
  <pre><code>use AppBundle\Entity\aaPostcode;
  use AppBundle\Entity\abPostcode;
  use AppBundle\Entity\acPostcode;
  use AppBundle\Entity\adPostcode;
  </code></pre>
  
  <p>in such a way like this?</p>
  
  <pre><code>use AppBundle\Entity\*
  </code></pre>
  
  <p>Not sure if this is possible in Symfony.</p>
  
  <p>My next issue is using the the prefixedEntity within a loop like so -</p>
  
  <pre><code>new $entityPrefix
  </code></pre>
  
  <p>When i am setting $entityPrefix to the following format</p>
  
  <pre><code>$entityPrefix = str_replace([".csv"], "", $entityFilename) . "Postcode" . '()';
  </code></pre>
  
  <p>which returns the string of </p>
  
  <pre><code>"abPostcode()"
  </code></pre>
  
  <p>can anyone advise as to why calling </p>
  
  <pre><code>new $entityPrefix;
  </code></pre>
  
  <p>is not working</p>
  
  <p>Thanks in advance for any help!</p>
  
  <p>trying to call</p>
  
  <pre><code>new $entityPrefix();
  </code></pre>
  
  <p>returns </p>
  
  <pre><code>[Symfony\Component\Debug\Exception\ClassNotFoundException]           
  Attempted to load class "abPostcode" from the global namespace.      
  Did you forget a "use" statement for "AppBundle\Entity\abPostcode"?  
  </code></pre>
  
  <p>even when i current am hrd coding the use stament to call </p>
  
  <pre><code>use AppBundle\Entity\abPostcode;
  </code></pre>