mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
SingleTable inherited entity collection is accessed without being initialized #7132
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 @pkly on GitHub (Apr 13, 2023).
Bug Report
Summary
An abstract entity with a setup like so
Using typed properties throws an error when calling it's getter,
getChildrenFiles(): Collectionwhich simply returns the$childrenFilesproperty.This behavior does not occur when not using typed properties in an older version of Doctrine, on php7.4 (currently in the process of upgrading)
Current behavior
Error message is shown when attempting to call
getChildrenFileswhich returns a Collection<int, self>How to reproduce
Use the class above along with something like this
then load the entity SubFile (any existing, valid) and call $subFile->getChildrenFiles(), for some reason doctrine does not automatically hydrate the property with an empty collection, nor is the constructor called.
Expected behavior
An empty collection is returned by
getChildrenFilesgetter inBaseFile@pkly commented on GitHub (Apr 13, 2023):
I'm sorry, it seems that I was mistaken and instead it was an issue with me loading some info about an object when it was read back from cache.