#85571Extbase should return an empty ObjectStorage instead of null on empty relations
Description
Mapping non-scalar properties to null is OK for single relations (to own models or \DateTime, for example) – if it’s not there it is null by definition.
But properties that are mapped to an ObjectStorage should never be null, they should be an empty ObjectStorage instead if there’s no relation. This would prevent such bugs: #85172 – especially in large projects it’s hard to track whether all ObjectStorages in all models are initialized correctly.
To be explicit, I expect the following to be always an ObjectStorage (which can itself have a count of 0, be empty, of course) after Extbase is done with the mapping:
/**
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\My\Related\Class>
*/
protected $relatedObjects;
Currently Extbase maps this to null, when there are no items in the relation.
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.