title: One entity to multiple tables with symfony/doctrine
body: <h2>Introduction</h2>
  
  <p>I'm working on a symfony3 project and I have a lot of different "types" for certain entities. What I mean by this is that, I have a <code>TypeUser</code>, <code>TypeEvent</code>, <code>TypeMeeting</code> tables.</p>
  
  <p>These tables will only have an <code>id</code> and a <code>label</code>.</p>
  
  <h2>Problem:</h2>
  
  <p>When using doctrine, I can link 1 entity to 1 table using the anotations, like so:</p>
  
  <pre><code>/**
   * @ORM\Entity
   * @ORM\Table(name="TypeUser")
   */
  </code></pre>
  
  <p>However, I would like this part to be completely generic. How can I specify the Table name depending on the type I need?</p>
  
  <p>Is there another alternative when using Doctrine other than the annotations to make this possible?</p>
  
  <p>I would really like to avoid making <code>n</code> entities for <code>n</code> tables, when they are very similar in name and in structure.</p>
  
  <h2>Question:</h2>
  
  <p>Is it possible to make one generic entity to match a specific TypeXXXX table, to reduce redundancy? If so how would I go about doing it?</p>
  
  <hr>
  
  <p>Similar <a href="https://stackoverflow.com/questions/7198271/doctrine-2-1-map-entity-to-multiple-tables">Doctrine 2.1 - Map entity to multiple tables</a> </p>
  
  <hr>
  
  <p><a href="http://symfony.com/doc/current/book/doctrine.html" rel="nofollow noreferrer">Symfony book on doctrine</a></p>