The main question:
Is it possible to map the association using the Doctrine link, not a primary key, but only a unique key?
Extended version:
I have an Entity ( Participation ) that can reference 2 other objects ( DropoutCause and DischargeType ). Depending on this combination, some other attributes are implied based on another (4th) table ( DropoutScenario ) in the database. Since either of the two reference objects can be empty, I could not declare them primary, but only a unique key in the 4th table.
The problem is that I get an error when trying to map this to Doctrine:
Missing value for primary key ID Application \ Entity \ Training \ DropoutScenario
Am I doing something wrong, or is it simply not possible with the Doctrine? If not, is there a better solution, how can I do this?
I searched for quite some time and dug the Doctrine documentation, but I just couldn't find anything in this ...
Cut out code samples of my comparisons below.
Participation:
<?php namespace Application\Entity\Trainings; use Doctrine\ORM\Mapping as ORM; abstract class Participation { protected $id; protected $dropoutCause; protected $dischargeType; private $scenario;
DropoutScenario:
<?php namespace Application\Entity\Trainings; use Doctrine\ORM\Mapping as ORM; class DropoutScenario { protected $id; protected $dropoutCause; protected $dischargeType; protected $dropoutCauseId; protected $dischargeTypeId;
source share