Issue Bug Closed

#101400GenericObjectValidator throws exception with lazy loaded objects

Torben Hansen 07/20/23, 16:36 updated 07/09/24, 14:15

Description

When a property of an Extbase domain model is lazy loaded but the current value does not exist any more (e.g. related record has been deleted), an exception is thrown when the domain model is validated through the GenericObjectValidator

PHP Warning: Attempt to read property "myProperty" on null in /path/to/typo3/sysext/extbase/Classes/Persistence/Generic/LazyLoadingProxy.php line 25

There is a TODO in getPropertyValue() method in GenericObjectValidator which says add support for lazy loading proxies, if needed. The TODO is IMO wrong here, since we already support lazy loaded proxies, but the ObjectAccess::isPropertyGettable function on the lazy loaded proxy results in loading an object which does not exist any more. Therefore the validator fails with an exception.

Reviews 4