title: Symfony - how to make Doctrine search in abstract mapped superclass?
body: <p>I am building an online shop for plastic model makers (hence the 'model').</p>
  
  <p>I have a <code>Product</code> mapped superclass because I want all products (models, tools, paints etc. to have name, price and description):</p>
  
  <pre><code>&lt;?php    
  namespace AppBundle\Entity;
  
  use Doctrine\ORM\Mapping as ORM;
  use Doctrine\ORM\Mapping\MappedSuperclass;
  use Gedmo\Mapping\Annotation as Gedmo; // gedmo annotations
  
  /** @MappedSuperclass */
  abstract class Product
  {
      /**
       * @ORM\Column(type="integer")
       * @ORM\Id
       * @ORM\GeneratedValue(strategy="AUTO")
       */
      private $id;
  
      /**
       * @var string
       * @ORM\Column(type="string", length=100, nullable=false)
       */
      protected $name;
  
      /**
       * @var int
       * @ORM\Column(type="decimal", scale=2, nullable=false)
       */
      protected $price;
  
      /**
       * @var string
       * @ORM\Column(type="text", nullable=true)
       */
      protected $description;
  
      /**
       * @Gedmo\Timestampable(on="create")
       * @ORM\Column(type="datetime")
       */
      private $createdAt;
  
      /**
       * @ORM\Column(type="datetime")
       * @Gedmo\Timestampable(on="update")
       */
      private $updatedAt;
  
      //getters and setters...
  
  }
  </code></pre>
  
  <p>Then, there's a <code>Model</code> class, for plastic models, this extends the <code>Product</code> class but also has a <code>Category</code> for being able to search from cars, aircraft, ships etc: </p>
  
  <pre><code>&lt;?php    
  namespace AppBundle\Entity;
  
  use Doctrine\ORM\Mapping as ORM;
  
  /**
   * @ORM\Entity
   * @ORM\Table(name="model")
   */
  class Model extends Product
  {
  
      /**
       * @var Category
       * @ORM\ManyToOne(targetEntity="AppBundle\Entity\Category", inversedBy="models")
       * @ORM\JoinColumn(name="category_id", referencedColumnName="id", nullable=true)
       */
      private $category;
  
      /**
       * @return Category
       */
      public function getCategory()
      {
          return $this-&gt;category;
      }
  
      /**
       * @param Category $category
       */
      public function setCategory($category)
      {
          $this-&gt;category = $category;
      }
  
  
  }
  </code></pre>
  
  <p>There will of course be more classes extending <code>Product</code> mapped superclass. Now I want to select the 10 most recently added products, regardless of their kind (models, tools, paints). </p>
  
  <p>How can I tell Doctrine to give me the last 10 added products? Of course I tried something like:
  <code>$this-&gt;getDoctrine()-&gt;getManager()-&gt;getRepository("AppBundle:Product");</code></p>
  
  <p>but of course it throws an exception saying that </p>
  
  <blockquote>
    <p>SQLSTATE[42S02]: Base table or view not found: 1146 Table
    'modeller_app.product' doesn't exist</p>
  </blockquote>
  
  <p>which obviously is true, because <code>Product</code> is an abstract class and not actually an entity. How can I solve this problem?</p>