title: Doctrine2: Mapping a parent class field from a child, how?
body: <p>I'm wondering if this can be done using Doctrine annotations:</p>
  
  <p>Say you have a parent class (a mapped superclass):</p>
  
  <pre><code>abstract class AbstractParent {
      protected $foo;
  }
  </code></pre>
  
  <p>which as two child classes:</p>
  
  <pre><code>class ConcreteChild1 extends AbstractParent {
      /**
       * @OneToOne(targetEntity="SomeEntity")
       */
      // How can I map this to foo above?
  }
  
  class ConcreteChild2 extends AbstractParent {
      /**
       * @OneToOne(targetEntity="SomeOtherEntity")
       */
      // How can I map this to foo above?
  }
  </code></pre>
  
  <p><code>SomeEntity</code> and <code>SomeOtherEntity</code> both share the same parent interface (<code>SomeEntityInterface</code>) but I don't want to just map the <code>$foo</code> field on the mapped superclass <code>AbstractParent</code> to this parent interface (<code>SomeEntityInterface</code>) as doctrine incurs a performance overhead (it loses lazy loading for mapping a class high in a hierarchy) (i.e. I don't want to use Single Table or Class Table Inheritance).</p>
  
  <p>With YML the solution is simple as you can still map foo even though its on a parent class:</p>
  
  <pre><code>ConcreteChild1:
  type: entity
  oneToOne:
    foo:
      targetEntity: SomeEntity
  </code></pre>
  
  <p>and</p>
  
  <pre><code>ConcreteChild2:
  type: entity
  oneToOne:
    foo:
      targetEntity: SomeOtherEntity
  </code></pre>
  
  <p>So must I use YML or is there something I'm missing that would allow me to map <code>$foo</code> through an annotation?</p>
  
  <p>Thanks greatly in advance, I know this is a bit of a hard one to follow!</p>