#94486Update Model with LazyLoadingProzy
Description
Hi,
i have a model called “Book” with a field lecturer that is lazy loaded:
/**
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
* @var \Varioous\VaTemplate\Domain\Model\Lecturer
*/
protected $lecturer = null;
Then i want to update a Book B with the lecturer of Book a (via DataHandler -> proccessdatamapHook):
//not working
$book->setLecturer($parent->getLecturer());
$bookRepository->update($book);
$persistenceManager->persistAll();
if i load the lazy loaded instance, it works
if ($parent->getLecturer() instanceof LazyLoadingProxy) {
$parent->getLecturer()->_loadRealInstance();
}
$book->setLecturer($parent->getLecturer());
$bookRepository->update($book);
$persistenceManager->persistAll();
Should be automatically handled by the update function of the Repository.
Reviews 2
Related issues 1
History 57
-
varioous OG changed project id subject
Update Model iwth LazyLoadingProzyUpdate Model with LazyLoadingProzy TYPO3 Version 10 PHP Version 7.4 Tags repository Complexity easy <span data-processor="relativetime" data-value="2021-07-06T08:18:13+00:00" > 07/06/21, 08:18 </span> -
Alexander Schnitzler changed Related to #111139 <span data-processor="relativetime" data-value="2026-10-19T06:22:59+00:00" > 10/19/26, 06:22 </span>
-
Alexander Schnitzler commented and changed assigned to Alexander Schnitzler target version <span data-processor="relativetime" data-value="2026-10-19T06:24:13+00:00" > 10/19/26, 06:24 </span>
-
Alexander Schnitzler changed category <span data-processor="relativetime" data-value="2026-10-19T06:24:39+00:00" > 10/19/26, 06:24 </span>
-
Gerrit Code Review pushed patch set 1 for main to change 96848 status
NewUnder Review <span data-processor="relativetime" data-value="2026-10-19T06:39:34+00:00" > 10/19/26, 06:39 </span> -
Gerrit Code Review pushed patch set 2 for main to change 96848 <span data-processor="relativetime" data-value="2026-10-19T06:55:51+00:00" > 10/19/26, 06:55 </span>
-
Anonymous commented and changed status
Under ReviewResolved done0 %100 % <span data-processor="relativetime" data-value="2026-10-28T16:05:12+00:00" > 10/28/26, 16:05 </span>Applied in changeset commit:10cc3a7455f1581ef034ffcf29e8687260e44c72.
Still reproducible on main with native lazy objects (since
”[FEATURE] Use native PHP lazy objects for Extbase lazy loading”):
It works when the proxy was initialized before the assignment.
Cause: Backend::persistObject() skips every property whose value
is an uninitialized lazy object (propertyValueIsLazyLoaded()),
before the dirty check. That is meant for the object’s own untouched
lazy relation, but also hits a proxy assigned from another object.
The uid of the proxy is already set without initializing it.