A cycle has been detected, so a topological sort is not possible. The getCycle() method provides the list of nodes that form the cycle. #11438
Unanswered
collmomo
asked this question in
Support Questions
Replies: 1 comment
-
I had this same issue and it was actually that we were assigning #[ORM\ManyToOne(targetEntity: self::class)]
#[ORM\JoinColumn(name: 'parent_id', referencedColumnName: 'id')]
protected Foo $parent;
public function __construct(
?Foo $parent = null
) {
$this->parent = $parent ?? $this;
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
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
OneToOne
relations.More context here: Stackoverflow
How to reproduce
OneToOne relations with
self
usingcascade:remove
Expected 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:
Beta Was this translation helpful? Give feedback.
All reactions