mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
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?
Original Pull Request: https://github.com/doctrine/orm/pull/6533
State: closed
Merged: No
As suggested by @lcobucci, I created a PR with a minimal test example.
While working on the test example I looked into the code and found the (probable) cause for this issue and proposed a fix for it in a second commit.
The issue seems to originate from the part of the code in UnitOfWork which calculates the weight for new dependencies in the graph based on whether or not the
nullableclause on join columns is set and to which value.In particular the part
(int)empty($joinColumns['nullable'])which to me seems incorrect. With the current implementation inmasterthe case where thenullableproperty on the join column is set to false (so, the relation is mandatory) yields the same weight as when thenullableproperty is not defined. But when thenullableproperty is not defined, the documention states that the default would benullable === true.Below, you find a simple truth table breakdown of the specific part of the code (for the possible values for
$joinColumns['nullable'].(int)empty( $joinColumns['nullable'] )I tried to keep the (in-line) fix as compact as possible. All test keep running and the added test for this issue also succeeds after applying the fix. Before applying the fix, it throws a ConstraintViolationException and tries to insert null for a mandatory foreign key.
Since I'm not completely familiar with the codebase, please look into whether this does not influence other parts of the code. If there's anything I can do to assist, let me know.