title: Symfony2 No mapping file found
body: <p>am working on symfony2 and am geting this error:</p>
  
  <blockquote>
    <p>No mapping file found named 'Acme.BlogBundle.Entity.Posts.php' for
    class 'Acme\BlogBundle\Entity\Posts'. 500 Internal Server Error -
    MappingException</p>
  </blockquote>
  
  <p>I generate Entity php <strong>app/console doctrine:generate:entity</strong></p>
  
  <p>Name of entity: <strong>AcmeBlogBundle:Post</strong></p>
  
  <p>Format: <strong>php</strong></p>
  
  <p>All that i put in <strong>Acme:BlogBundle:Entity</strong> directory.</p>
  
  <p>This is my Entity Post class with getter and setter methds:</p>
  
  <pre><code>&lt;?php
  
  namespace Acme\BlogBundle\Entity;
  
  use Doctrine\ORM\Mapping as ORM;
  
  /**
   * Posts
   */
  class Posts
  {
      /**
       * @var integer
       */
      private $id;
  
      /**
       * @var string
       */
      private $title;
  
      /**
       * @var string
       */
      private $shortText;
  
      /**
       * @var string
       */
      private $longText;
  
      /**
       * @var string
       */
      private $author;
  
      /**
       * @var \DateTime
       */
      private $dateCreated;
  
      /**
       * @var \DateTime
       */
      private $dateModified;
  
  
      /**
       * Get id
       *
       * @return integer 
       */
      public function getId()
      {
          return $this-&gt;id;
      }
  
      /**
       * Set title
       *
       * @param string $title
       * @return Posts
       */
      public function setTitle($title)
      {
          $this-&gt;title = $title;
  
          return $this;
      }
  
      /**
       * Get title
       *
       * @return string 
       */
      public function getTitle()
      {
          return $this-&gt;title;
      }
  
      /**
       * Set shortText
       *
       * @param string $shortText
       * @return Posts
       */
      public function setShortText($shortText)
      {
          $this-&gt;shortText = $shortText;
  
          return $this;
      }
  
      /**
       * Get shortText
       *
       * @return string 
       */
      public function getShortText()
      {
          return $this-&gt;shortText;
      }
  
      /**
       * Set longText
       *
       * @param string $longText
       * @return Posts
       */
      public function setLongText($longText)
      {
          $this-&gt;longText = $longText;
  
          return $this;
      }
  
      /**
       * Get longText
       *
       * @return string 
       */
      public function getLongText()
      {
          return $this-&gt;longText;
      }
  
      /**
       * Set author
       *
       * @param string $author
       * @return Posts
       */
      public function setAuthor($author)
      {
          $this-&gt;author = $author;
  
          return $this;
      }
  
      /**
       * Get author
       *
       * @return string 
       */
      public function getAuthor()
      {
          return $this-&gt;author;
      }
  
      /**
       * Set dateCreated
       *
       * @param \DateTime $dateCreated
       * @return Posts
       */
      public function setDateCreated($dateCreated)
      {
          $this-&gt;dateCreated = $dateCreated;
  
          return $this;
      }
  
      /**
       * Get dateCreated
       *
       * @return \DateTime 
       */
      public function getDateCreated()
      {
          return $this-&gt;dateCreated;
      }
  
      /**
       * Set dateModified
       *
       * @param \DateTime $dateModified
       * @return Posts
       */
      public function setDateModified($dateModified)
      {
          $this-&gt;dateModified = $dateModified;
  
          return $this;
      }
  
      /**
       * Get dateModified
       *
       * @return \DateTime 
       */
      public function getDateModified()
      {
          return $this-&gt;dateModified;
      }
  }
  </code></pre>
  
  <p>In my controller i first set Post Entity after definig namespace of controller.</p>
  
  <pre><code>use Acme\BlogBundle\Entity\Posts;
  </code></pre>
  
  <p>After that i create method </p>
  
  <pre><code>    public function AddAction()
      { 
  
          // $post = Acme\BlogBundle\Entity\Posts()
  
           $posts = new Posts();
           $posts-&gt;setTitle('Test Title');
  
           $em = $this-&gt;getDoctrine()-&gt;getManager();
           $em-&gt;persist($posts);
           $em-&gt;flush();
  }
  </code></pre>
  
  <p>Here is and <strong>Stack Trace</strong> output</p>
  
  <blockquote>
    <p>[1] Doctrine\Common\Persistence\Mapping\MappingException: No mapping
    file found named 'Acme.BlogBundle.Entity.Posts.php' for class
    'Acme\BlogBundle\Entity\Posts'.
    at n/a
    in /var/www/html/Symfony/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/MappingException.php
    line 74</p>
    
    <p>at Doctrine\Common\Persistence\Mapping\MappingException::mappingFileNotFound('Acme\BlogBundle\Entity\Posts',
    'Acme.BlogBundle.Entity.Posts.php')
    in /var/www/html/Symfony/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/DefaultFileLocator.php
    line 117</p>
    
    <p>at Doctrine\Common\Persistence\Mapping\Driver\DefaultFileLocator->findMappingFile('Acme\BlogBundle\Entity\Posts')
    in /var/www/html/Symfony/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/PHPDriver.php
    line 59</p>
    
    <p>at Doctrine\Common\Persistence\Mapping\Driver\PHPDriver->loadMetadataForClass('Acme\BlogBundle\Entity\Posts',
    object(ClassMetadata))
    in /var/www/html/Symfony/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/MappingDriverChain.php
    line 104</p>
    
    <p>at Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain->loadMetadataForClass('Acme\BlogBundle\Entity\Posts',
    object(ClassMetadata))
    in /var/www/html/Symfony/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php
    line 113</p>
  
  <pre><code>at Doctrine\ORM\Mapping\ClassMetadataFactory-&gt;doLoadMetadata(object(ClassMetadata),
  </code></pre>
    
    <p>null, false, array())
            in /var/www/html/Symfony/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php
    line 302</p>
  
  <pre><code>at Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory-&gt;loadMetadata('Acme\BlogBundle\Entity\Posts')
      in /var/www/html/Symfony/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php
  </code></pre>
    
    <p>line 205</p>
    
    <p>at Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory->getMetadataFor('Acme\BlogBundle\Entity\Posts')
    in /var/www/html/Symfony/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php
    line 268</p>
    
    <p>at Doctrine\ORM\EntityManager->getClassMetadata('Acme\BlogBundle\Entity\Posts')
    in /var/www/html/Symfony/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php
    line 1580</p>
    
    <p>at Doctrine\ORM\UnitOfWork->doPersist(object(Posts), array('000000000d824498000000009cdc8511' => object(Posts)))
    in /var/www/html/Symfony/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php
    line 1555</p>
    
    <p>at Doctrine\ORM\UnitOfWork->persist(object(Posts))
    in /var/www/html/Symfony/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php
    line 565</p>
    
    <p>at Doctrine\ORM\EntityManager->persist(object(Posts))
            in /var/www/html/Symfony/src/Acme/BlogBundle/Controller/DefaultController.php
    line 23</p>
    
    <p>at Acme\BlogBundle\Controller\DefaultController->indexAction()
    in  line </p>
    
    <p>at call_user_func_array(array(object(DefaultController), 'indexAction'), array())
    in /var/www/html/Symfony/app/bootstrap.php.cache line 2815</p>
    
    <p>at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request),
    '1')
    in /var/www/html/Symfony/app/bootstrap.php.cache line 2789</p>
    
    <p>at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), '1',
    true)
    in /var/www/html/Symfony/app/bootstrap.php.cache line 2918</p>
    
    <p>at Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel->handle(object(Request),
    '1', true)
    in /var/www/html/Symfony/app/bootstrap.php.cache line 2220</p>
    
    <p>at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
    in /var/www/html/Symfony/web/app_dev.php line 28</p>
  </blockquote>
  
  <p>Update:</p>
  
  <p><strong>New Entity Test:</strong></p>
  
  <pre><code>&lt;?php
  // src/Acme/BlogBundle/Entity/Test.php
  namespace Acme\BlogBundle\Entity;
  
  use Doctrine\ORM\Mapping as ORM;
  
  /**
   * @ORM\Table()
   * @ORM\Entity
   */
  class Test
  {
      /**
       * @var integer
       *
       * @ORM\Column(name="id", type="integer")
       * @ORM\Id
       * @ORM\GeneratedValue(strategy="AUTO")
       */
      private $id;
  
      /**
       * @var string
       *
       * @ORM\Column(name="title", type="string", length=255)
       */
      private $title;
  
      /**
       * @var string
       *
       * @ORM\Column(name="short_text", type="string", length=255)
       */
      private $shortText;
  
      /**
       * @var string
       *
       * @ORM\Column(name="long_text", type="text")
       */
      private $longText;
  
      /**
       * @var \DateTime
       *
       * @ORM\Column(name="date_created", type="datetime")
       */
      private $dateCreated;
  
  
      /**
       * Get id
       *
       * @return integer 
       */
      public function getId()
      {
          return $this-&gt;id;
      }
  
      /**
       * Set title
       *
       * @param string $title
       * @return Test
       */
      public function setTitle($title)
      {
          $this-&gt;title = $title;
  
          return $this;
      }
  
      /**
       * Get title
       *
       * @return string 
       */
      public function getTitle()
      {
          return $this-&gt;title;
      }
  
      /**
       * Set shortText
       *
       * @param string $shortText
       * @return Test
       */
      public function setShortText($shortText)
      {
          $this-&gt;shortText = $shortText;
  
          return $this;
      }
  
      /**
       * Get shortText
       *
       * @return string 
       */
      public function getShortText()
      {
          return $this-&gt;shortText;
      }
  
      /**
       * Set longText
       *
       * @param string $longText
       * @return Test
       */
      public function setLongText($longText)
      {
          $this-&gt;longText = $longText;
  
          return $this;
      }
  
      /**
       * Get longText
       *
       * @return string 
       */
      public function getLongText()
      {
          return $this-&gt;longText;
      }
  
      /**
       * Set dateCreated
       *
       * @param \DateTime $dateCreated
       * @return Test
       */
      public function setDateCreated($dateCreated)
      {
          $this-&gt;dateCreated = $dateCreated;
  
          return $this;
      }
  
      /**
       * Get dateCreated
       *
       * @return \DateTime 
       */
      public function getDateCreated()
      {
          return $this-&gt;dateCreated;
      }
  }
  </code></pre>
  
  <p>Again the some error</p>
  
  <p><strong>$ php app/console doctrine:generate:entities AcmeBlogBundle</strong></p>
  
  <blockquote>
    <p>Generating entities for bundle "AcmeBlogBundle"</p>
  
  <pre><code>                                                                [RuntimeException]                                               
  </code></pre>
    
    <p>Bundle "AcmeBlogBundle" does not contain any mapped entities.  </p>
    
    <p>doctrine:generate:entities [--path="..."] [--no-backup] name</p>
  </blockquote>