I am trying to set up a relationship as shown below. Each car can have one review. A car has a primary key on 2 columns. Review is referenced back to the car via the composite primary key. Simple, in theory.
class Car {
/**
* @ORM\Id
* @ORM\Column(type="string")
*/
private $make;
/**
* @ORM\Id
* @ORM\Column(type="string")
*/
private $model;
/**
*
* @ORM\OneToOne(targetEntity="Review", mappedBy="car", cascade={"persist"})
*/
private $review;
}
class Review {
/**
* @ORM\Id
* @ORM\OneToOne(targetEntity="Car", inversedBy="review")
*/
private $car;
/**
* @var @ORM\Column(type="text")
*/
private $text;
}
When I try to generate the schema, the following error pops up.
Column name
id
referenced for relation from \Entity\Review towards \Entity\Car does not exist.
What am I doing wrong?