title: Symfony 2.1 Doctrine in Newly Created Bundles
body: <p>Wondering if anybody else has run into this issue. In summary, we upgraded from Symfony 2.0 to Symfony 2.1. With Symfony 2.1 if a create a brand new bundle and then an entity to use with Doctrine I get a <code>"not a valid entity or mapped super class"</code>. If I place the same exact entity class (with proper path changes) into an existing bundle (created before 2.1) it can be accessed with no problems, even from the new bundle.</p>
  
  <p>Here are the steps.</p>
  
  <pre><code>$ php app/console generate:bundle --namespace="Core/TestBundle"--format=yml --no-interaction --structure=no --dir=src 
  $ php app/console doctrine:generate:entity --entity="CoreTestBundle:Product" --fields="name:string(255) price:float description:text" 
  </code></pre>
  
  <p>here is the Product.php code produced</p>
  
  <pre><code>&lt;?php
  
  namespace Core\TestBundle\Entity;
  
  use Doctrine\ORM\Mapping as ORM;
  
  /**
   * Core\TestBundle\Entity\Product
   *
   * @ORM\Table()
   * @ORM\Entity
   */
  class Product
  {
  /**
   * @var integer $id
   *
   * @ORM\Column(name="id", type="integer")
   * @ORM\Id
   * @ORM\GeneratedValue(strategy="AUTO")
   */
  private $id;
  
  /**
   * @var string $name
   *
   * @ORM\Column(name="name", type="string", length=255)
   */
  private $name;
  
  /**
   * @var float $price
   *
   * @ORM\Column(name="price", type="float")
   */
  private $price;
  
  /**
   * @var text $description
   *
   * @ORM\Column(name="description", type="text")
   */
  private $description;
  
  
  /**
   * Get id
   *
   * @return integer
   */
  public function getId()
  {
      return $this-&gt;id;
  }
  
  /**
   * Set name
   *
   * @param string $name
   * @return Product
   */
  public function setName($name)
  {
      $this-&gt;name = $name;
      return $this;
  }
  
  /**
   * Get name
   *
   * @return string
   */
  public function getName()
  {
      return $this-&gt;name;
  }
  
  /**
   * Set price
   *
   * @param float $price
   * @return Product
   */
  public function setPrice($price)
  {
      $this-&gt;price = $price;
      return $this;
  }
  
  /**
   * Get price
   *
   * @return float
   */
  public function getPrice()
  {
      return $this-&gt;price;
  }
  
  /**
   * Set description
   *
   * @param text $description
   * @return Product
   */
  public function setDescription($description)
  {
      $this-&gt;description = $description;
      return $this;
  }
  
  /**
   * Get description
   *
   * @return text
   */
  public function getDescription()
  {
      return $this-&gt;description;
  }
  }
  </code></pre>
  
  <p>from here running </p>
  
  <pre><code>$ php app/console doctrine:generate:entities "Core/TestBundle/Entity/Product" 
  </code></pre>
  
  <p>or accessing Product from code runs into<br>
     <code>[Doctrine\ORM\Mapping\MappingException]  Class
     Core\TestBundle\Entity\Product is not a valid entity or mapped super 
     class.</code> running<br>
      <code>$ php app/console doctrine:schema:update --force</code>
     produces "Nothing to update"</p>
  
  <p>On the other hand, if I use a pre-existing bundle such as ArticleBundle and run the same commands ie</p>
  
  <pre><code>$ php app/console doctrine:generate:entity --entity="CoreArticleBundle:Product" --fields="name:string(255) price:float description:text"
  $ php app/console doctrine:generate:entities "Core/ArticleBundle/Entity/Product"
  $ php app/console doctrine:schema:update --force 
  </code></pre>
  
  <p>creates the table fine
  Also, accessing the Product from the TestBundle as <code>CoreArticleBundle:Product</code> works fine.
  I tried to compare the bundle configurations etc but couldn't come up with anything.</p>
  
  <p>I also run the db creation scripts as follows.</p>
  
  <pre><code>$ php app/console doctrine:database:drop --force 
  </code></pre>
  
  <p>Dropped database for connection named dev </p>
  
  <pre><code>$ php app/console doctrine:database:create 
  </code></pre>
  
  <p>Created database for connection named dev
  All the tables got created except for the Product one.</p>
  
  <p>In addition I created a fixture with the Product object. Same thing. Works when in an existing bundle. Same error as above in the newly created bundle.</p>