title: Doctrine 2 one-to-one via composite key of both entities
body: <p>I have a question similar <a href="https://stackoverflow.com/questions/8356848/doctrine-2-one-to-one-via-composite-key">to this one</a>.</p>
  
  <p>I need a relation one-to-one through composite key, is it possible? I've read about <a href="http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/tutorials/composite-primary-keys.html#use-case-1-dynamic-attributes" rel="nofollow noreferrer">this</a> but it's referred to one-to-many relation</p>
  
  <pre><code>class Header{
      /**
       * 
       * @ORM\Id
       * @ORM\Column(name="UH1", type="integer", nullable=false)
       */
      protected $key1;
  
      /**
       * 
       * @ORM\Id
       * @ORM\Column(name="UH2", type="integer", nullable=false)
       */
      protected $key2;
  
      /**
       * @ORM\OneToOne(targetEntity="Detail", mappedBy="header")
       */
      protected $detail;
  } 
  
  class Detail{
  /**
       * 
       * @ORM\Id
       * @ORM\Column(name="UD1", type="integer", nullable=false)
       */
      protected $key1;
  
      /**
       * 
       * @ORM\Id
       * @ORM\Column(name="UD2", type="integer", nullable=false)
       */
      protected $key2;
  
      /**
       * @ORM\OneToOne(targetEntity="Header", inversedBy="detail")
       */
      protected $header;
  }
  </code></pre>
  
  <p>I mean there are two columns as Id per entity... do i need to add <a href="http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/association-mapping.html#one-to-one-bidirectional" rel="nofollow noreferrer">the joincolumn</a> ?</p>