I have a question similar to this one.
I need a relation one-to-one through composite key, is it possible? I've read about this but it's referred to one-to-many relation
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;
}
I mean there are two columns as Id per entity... do i need to add the joincolumn ?