mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
A cycle has been detected, so a topological sort is not possible. The getCycle() method provides the list of nodes that form the cycle. #7366
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @collmomo on GitHub (May 5, 2024).
Bug Report
Summary
The following message get thrown: "A cycle has been detected, so a topological sort is not possible. The getCycle() method provides the list of nodes that form the cycle." after removing/flushing an entity while using semantically correct doctrine syntax and sound logic
Current behavior
Blocking the flush process from removing the entity while using
OneToOnerelations.More context here: Stackoverflow
How to reproduce
OneToOne relations with
selfusingcascade:removeExpected behavior
Don't throw the error, there's no cycle (infinite loop?) here, just remove the entity.
I fixed the issue by adding the following attribute:
#[ORM\JoinColumn(nullable: true, onDelete: 'CASCADE')]Another solution could have been to manually clear the relations before removing the entity: