title: Association mapping with mapped superclass
body: <p>In my vendor bundle, I have 2 mapped superclass : BaseSite and BaseSection (which are abstract).</p>
  
  <p>In my application bundle, I have 2 entities that extends the 2 mapped superclass.
  Everything works so far: I have access to the fields defined in the superclasses and I can add new ones in my application bundle if needed.</p>
  
  <p>The problem is when I am trying to define my association mapping between those entities. (manyToOne between BaseSection and BaseSite).
  If I define it in the BaseSection mapped superclass, I am able to run the command <code>app/console doctrine:generate:entities AcmeDemoBundle</code>, but it doesn't work when
  I try to create the tables: (<code>app/console doctrine:schema:update --dump-sql</code>)</p>
  
  <pre class="lang-sql prettyprint-override"><code>CREATE TABLE Section (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, siteId INT DEFAULT NULL, INDEX IDX_95E06DEFFADB670C (siteId), PRIMARY KEY(id)) ENGINE = InnoDB;
  CREATE TABLE Site (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id)) ENGINE = InnoDB;
  ALTER TABLE Section ADD CONSTRAINT FK_95E06DEFFADB670C FOREIGN KEY (siteId) REFERENCES BaseSite(id) ON DELETE CASCADE
  </code></pre>
  
  <p>As you can see, it tries to reference the foreign key on a table that doesn't exists (BaseSite instead of Site). I'm guessing this is because the mapped superclass isn't aware of the table name defined in the application entity.</p>
  
  <p>I could define the association mapping on the application entities instead, but that would mean that if someone wanted to use my bundle, he would have to define the mapping himself, which I would like to avoid.</p>
  
  <p>Is there another way to do this or maybe I'm just missing something?</p>
  
  <p>Here is my code:</p>
  
  <p><strong>Vendor :</strong></p>
  
  <p>File: <em>vendor\bundles\Acme\DemoBundle\Resources\config\doctrine\BaseSite.orm.yml</em></p>
  
  <pre><code>Acme\DemoBundle\Entity\BaseSite:
    type: mappedSuperclass
    fields:
      id:
        type: integer
        id: true
        generator:
          strategy: AUTO
      name:
        type: string
        length: 255
        nullable: false
      // ...
  </code></pre>
  
  <p>File: <em>vendor\bundles\Acme\DemoBundle\Resources\config\doctrine\BaseSection.orm.yml</em></p>
  
  <pre><code>Acme\DemoBundle\Entity\BaseSection:
    type: mappedSuperclass
    fields:
      id:
        type: integer
        id: true
        generator:
          strategy: AUTO
      name:
        type: string
        length: 255
        nullable: false
      // ...
    manyToOne:
      site:
        targetEntity: Acme\DemoBundle\Entity\BaseSite
        joinColumn:
          name: siteId
          referencedColumnName: id
          onDelete: cascade
  </code></pre>
  
  <p><strong>Application:</strong></p>
  
  <p>File: <em>src\Application\Acme\DemoBundle\Resources\config\doctrine\Site.orm.yml</em></p>
  
  <pre><code>Application\Acme\DemoBundle\Entity\Site:
    type: entity
    table: Site
  </code></pre>
  
  <p>File: <em>src\Application\Acme\DemoBundle\Entity\Site.php</em></p>
  
  <pre class="lang-php prettyprint-override"><code>&lt;?php
  
  namespace Application\Acme\DemoBundle\Entity;
  
  use Acme\DemoBundle\Entity\BaseSite;
  
  class Site extends BaseSite
  {
  }
  </code></pre>
  
  <p>File: <em>src\Application\Acme\DemoBundle\Resources\config\doctrine\Section.orm.yml</em></p>
  
  <pre><code>Application\Acme\DemoBundle\Entity\Section:
    type: entity
    table: Section
  </code></pre>
  
  <p>File: <em>src\Application\Acme\DemoBundle\Entity\Section.php</em></p>
  
  <pre class="lang-php prettyprint-override"><code>&lt;?php
  
  namespace Application\Acme\DemoBundle\Entity;
  
  use Acme\DemoBundle\Entity\BaseSection;
  
  class Section extends BaseSection
  {
  }
  </code></pre>