title: Doctrine. Class XXX is not a valid entity or mapped super class
body: <p>I'm trying to do my first DAO with Doctrine for doing a list method. My entity class is Canales.php in /src/model/dto folder</p>
  
  <pre><code>namespace model\dto;
  
  use Doctrine\ORM\Mapping as ORM;
  
  /**
   * Canales
   *
   * @ORM\Table(name="Canales")
   * @ORM\Entity
   */
  class Canales
  {
      /**
       * @var string
       *
       * @ORM\Column(name="Nombre", type="string", length=255, nullable=false)
       */
      private $nombre;
  
      /**
       * @var integer
       *
       * @ORM\Column(name="Id", type="integer")
       * @ORM\Id
       * @ORM\GeneratedValue(strategy="IDENTITY")
       */
      private $id;
  
      /**
       * Class Constructor
       * @param    $nombre   
       * @param    $id   
       */
      public function __construct($nombre, $id)
      {
          $this-&gt;nombre = $nombre;
          $this-&gt;url = $url;
          $this-&gt;imagen = $imagen;
          $this-&gt;ingles = $ingles;
          $this-&gt;id = $id;
      }
  
  
  
      /**
       * Set nombre
       *
       * @param string $nombre
       * @return Canales
       */
      public function setNombre($nombre)
      {
          $this-&gt;nombre = $nombre;
  
          return $this;
      }
  
      /**
       * Get nombre
       *
       * @return string 
       */
      public function getNombre()
      {
          return $this-&gt;nombre;
      }
  
      /**
       * Get id
       *
       * @return integer 
       */
      public function getId()
      {
          return $this-&gt;id;
      }
  }
  </code></pre>
  
  <p>This class was generate using these lines</p>
  
  <p>vendor/bin/doctrine orm:convert-mapping --from-database xml config/xml/</p>
  
  <p>vendor/bin/doctrine orm:generate-entities --generate-annotations=true --regenerate-entities=true src/</p>
  
  <p>my Dao class (in /src/model/dao folder)</p>
  
  <pre><code>class daoGenerico{
  private $entityManager;
  
  /**
   * Class Constructor
   * @param    $entityManager   
   */
  public function __construct()
  {
      require_once("bootstrap.php");
      $this-&gt;entityManager = $entityManager;
  }
  
  
  /**
   * @return mixed
   */
  public function getEntityManager()
  {
      return $this-&gt;entityManager;
  }
  
  function showAction(){
      $repository = $this-&gt;getEntityManager()-&gt;getRepository('model\dto\Canales');
          //-&gt;find($id);
      echo "..";
      $productos = $repository-&gt;findAll();
      echo "OK";
      if (!$productos) {
          throw $this-&gt;createNotFoundException(
              'No product found'
          );
      }
      else{
          var_dump($productos);
      }
  }   
  </code></pre>
  
  <p>}</p>
  
  <p>My bootstrap.php</p>
  
  <pre><code>// bootstrap.php
  
  use Doctrine\ORM\Tools\Setup;
  use Doctrine\ORM\EntityManager;
  
  require_once "vendor/autoload.php";
  
  // Create a simple "default" Doctrine ORM configuration for Annotations
  $isDevMode = true;
  $config = Setup::createAnnotationMetadataConfiguration(array(__DIR__."/src/model/dto"), $isDevMode);
  
  // database configuration parameters
  $conn = array(
      'driver'   =&gt; 'pdo_mysql',
      'host'     =&gt; 'localhost',
      'user'     =&gt; 'root',
      'password' =&gt; 'root',
      'dbname'   =&gt; 'yoga',
      'charset'  =&gt; 'UTF8',
  );
  
  // obtaining the entity manager
  $entityManager = EntityManager::create($conn, $config);
  </code></pre>
  
  <p>and my test.php file</p>
  
  <pre><code>include_once('./src/model/dao/daoGenerico.php');
  
  $daoGenerico = new daoGenerico();
  $daoGenerico-&gt;showAction();
  </code></pre>
  
  <p>The composer.json is this</p>
  
  <pre><code>{
     "require": {
          "doctrine/orm": "2.4.*"
      },
      "autoload": {
          "psr-0": {"": "src/"}
      }
  }
  </code></pre>
  
  <p>When I executed it, I have this error</p>
  
  <p>Fatal error: Uncaught exception 'Doctrine\ORM\Mapping\MappingException' with message 'Class "model\dto\Canales" is not a valid entity or mapped super class.' in /Applications/MAMP/htdocs/yoga/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/MappingException.php:336</p>
  
  <p>I have tried some similar questions in stackoverflow without results for me. Any idea or advice?</p>