title: Doctrine 2: Is there a way to inherit mapping from a trait using yaml or xml?
body: <p>I found the <a href="http://doctrine-orm.readthedocs.org/en/latest/tutorials/override-field-association-mappings-in-subclasses.html">following example in the doctrine documentation</a> where they have added mapping to a trait:</p>
  
  <pre><code>/**
   * Trait class
   */
  trait ExampleTrait
  {
      /** @Id @Column(type="string") */
      private $id;
  
      /**
       * @Column(name="trait_foo", type="integer", length=100, nullable=true, unique=true)
       */
      protected $foo;
  
      /**
       * @OneToOne(targetEntity="Bar", cascade={"persist", "merge"})
       * @JoinColumn(name="example_trait_bar_id", referencedColumnName="id")
       */
      protected $bar;
  }
  </code></pre>
  
  <p>I am trying to map a trait without having to duplicate the mapping in the classes that inherit it. I haven't honestly tried this above as my current project is using yaml for mapping but it looks like a regular php class would inherit the mapping as well when using the trait.</p>
  
  <p>Is there a way to inherit the mapping for this trait without using associations but using yaml or xml instead? I tried setting the trait as a <a href="http://docs.doctrine-project.org/en/latest/reference/inheritance-mapping.html#mapped-superclasses">mapped superclass</a> but it didn't work but I am basically looking for the same type of idea.</p>
  
  <p>Thanks.</p>