title: Symfony 2.8+, Doctrine Inheritance and Forms
body: <p>Before i start, Note that I'm learning symfony so keep that in mind ! I just want to understand how it works.
  Here's what i am trying to achieve :</p>
  
  <p>I would like to make a working crud example of entities inheritance using doctrine. So this is how my example looks like :</p>
  
  <ul>
  <li>Abstract Parent class : <strong>character</strong> </li>
  <li>Child class 1 : <strong>Magician</strong></li>
  <li>Child class 2 : <strong>Warrior</strong></li>
  <li>Child class 3 : <strong>Archer</strong></li>
  </ul>
  
  <p>So after reading some documentation i decided to use the STI (Single Table Inheritance) of Doctrine.</p>
  
  <p><em>Parent class :</em></p>
  
  <pre><code>/**
   * Character
   *
   * @ORM\Table(name="character")
   * @ORM\Entity(repositoryClass="AppBundle\Repository\CharacterRepository")
   * @ORM\InheritanceType("SINGLE_TABLE")
   * @ORM\DiscriminatorColumn(name="discr", type="string")
   * @ORM\DiscriminatorMap({"magician_db" = "Magician", "warrior_db" = "Warrior", "archer_db" = "Archer"})
   */
  
  abstract class Character{
      protected id;
      protected name;
      public function getId();
      public function getName();
      public function setName();
  }
  </code></pre>
  
  <p><em>Child Class 1 :</em></p>
  
  <pre><code>class Warrior extends Character{
         protected armor;
         public function battleShout();
  }
  </code></pre>
  
  <p><em>Child Class 2:</em></p>
  
  <pre><code>class Magician extends Character{
         protected silk;
         public function spellAnnounce();
  }
  </code></pre>
  
  <p><em>Child Class 3:</em></p>
  
  <pre><code>class Archer extends Character{
         protected leather;
         public function arrows();
  }
  </code></pre>
  
  <p>I managed to create the table in my db, and i successfully loaded my fixtures for tests purposes. I also made my main view work (listing all characters).</p>
  
  <hr>
  
  <p><strong>My Problem :</strong>
  Now i want to be able to create, edit &amp; delete a specific character in the list with a single form. So for example i would have a <strong>'type' select field where i can select 'warrior' , 'magician' or 'archer'</strong> and then i would be able to fill in the specific fields of the chosen entity. So let's say i choose 'warrior' in the form, then i would like to be able to set the <strong>armor property</strong> (along with the parents one of course) and persist it in the database.</p>
  
  <p>I don't know how to do it since my parent class is abstract so i can't create a form based on that object.</p>
  
  <p>Thx in advance for your help, i really need it !</p>
  
  <p><strong>PS: If there is a better solution / implementation don't hesitate !</strong></p>