title: foreign-key relationship with Doctrine concrete inheritance
body: <p>In my schema, I have a generic table <code>Animal</code> and an inherited table <code>Dog</code>.
  Before using doctrine, I used to implement this pattern with an inherited id referencing the generic id as foreign key.
  I can't reproduce the same with Doctrine, and I feel like something is missing.</p>
  
  <p>The schema I used to produce is the following :</p>
  
  <pre><code>CREATE TABLE `animal` (
    `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
    `color` VARCHAR(20) NOT NULL,
    PRIMARY KEY (`id`)
  );
  
  CREATE TABLE `dog` (
    `id` INT UNSIGNED NOT NULL,
    `breed` VARCHAR(40) NOT NULL,
    KEY `id` (`id`)
  );
  
  ALTER TABLE `dog` ADD CONSTRAINT FOREIGN KEY (`id`) REFERENCES `animal`(`id`);
  </code></pre>
  
  <p>I first tried to use Doctrine concrete inheritance, as it seemed the logical answer to this problem :</p>
  
  <p>Here is the YAML file :</p>
  
  <pre><code>Animal:
    columns:
      id: { primary: true , type: integer ,  autoincrement: true }
      color: { type: string(20) , notnull: true }
  Dog:
    columns:
      breed: { type: string(20) , notnull: true }
    inheritance:
      extends: Animal
      type: concrete
  </code></pre>
  
  <p>And the resulting SQL is :</p>
  
  <pre><code>CREATE TABLE `animal` (
    `id` BIGINT NOT NULL AUTO_INCREMENT,
    `color` VARCHAR(20) NOT NULL,
    PRIMARY KEY (`id`)
  );
  
  CREATE TABLE IF NOT EXISTS `dog` (
    `id` BIGINT NOT NULL AUTO_INCREMENT,
    `color` VARCHAR(20) NOT NULL,
    `breed` VARCHAR(20) NOT NULL,
    PRIMARY KEY (`id`)
  );
  </code></pre>
  
  <p>The duplication of the <code>color</code> column is OK, but where is the foreign key ? How do I ensure the integrity of my <code>dog.id</code> with my <code>animal.id</code> ? And what happens if I delete <code>animal</code>'s rows ?</p>
  
  <p>So I tried to use a simple one-to-one association :</p>
  
  <pre><code>Animal:
    columns:
      id: { primary: true , type: integer(10) , autoincrement: true }
      color: { type: string(20) , notnull: true }
  Dog:
    columns:
      animal_id: { primary: true , type: integer(10) }
      breed: { type: string(20) , notnull: true }
    relations:
      AnimalRecord:
        class: Animal
        foreignAlias: DogRecord
        type: one
        foreignType: one
        local: animal_id
        foreign: id
  </code></pre>
  
  <p>The result is the same as above (except the <code>color</code> column isn't duplicated, which is normal since the inheritance isn't explicited anymore), still no foreign key.</p>
  
  <p>If I just change the <code>animal_id</code> from <code>PRIMARY</code> to <code>UNIQUE</code>, the foreign key is created from <code>dog.animal_id</code> to <code>animal.id</code>, but a new autoincrement'ed <code>id</code> appears.</p>
  
  <p>It all behaves like being <code>PRIMARY</code> or <code>FOREIGN KEY</code> are exclusive for a column, and I can't understand why. Furthermore, it seems to me like a dangerous flaw.</p>