mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
Typed nullable @ManyToOne must not be accessed before initialization #6464
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 @vudaltsov on GitHub (May 12, 2020).
Bug Report
Summary
part of an entity:
Current behavior
When
isRoot()is accessed on a loaded root process,Process::$parentProcess must not be accessed before initializationis thrown.While constructor initialization is correct, I think the problem is that Doctrine does not call constructor. And this nullable property remains uninitialized for root processes.
The quick fix is to add a default value:
private ?self $parentProcess = null;@SenseException commented on GitHub (May 13, 2020):
I assume a null value doesn't get hydrated, because it wasn't necessary for the ORM to do this in the past.
@vudaltsov commented on GitHub (May 13, 2020):
@SenseException , yes, exactly. I hope I can find some time to do a PR