Hi guys
I’m struggling with this problem for many hours now
I have a simple self-referencing one-to-one relation in one of my domain models. It’s like a linked list: an item in the chain is pointing to its predecessor. Let’s say the model represents a sports season. So every season has previousSeason.
/**
* @ORM\OneToOne(orphanRemoval=false)
* @var Season
*/
protected $previousSeason;
This all works perfectly fine! What i’m struggling with is the unsetting of a relation. When we have seasons 2017 and 2015 the later one (2015) is the previousSeason of 2017. I’d like to unset this relation now. Therefore I call 2017->setPreviousSeason(null). Even this works fine. But the result in the DB is not only a unset relation (NULL value in corresponding “previousseason” field) but only a deleted season 2015.
→ How can I unset a one-to-one relation without deleting the referenced object?