#111139Repository: update() and remove() of a lazy-loaded relation fail
Description
Since Extbase uses native PHP lazy objects for lazy loading
(“[FEATURE] Use native PHP lazy objects for Extbase lazy loading”),
a lazy 1:1 or n:1 relation returns a native lazy proxy of the
target class. Passing that proxy to its repository fails.
update() throws, for an uninitialized and for an initialized proxy:
$blog = $blogRepository->findByUid(3);
$administrator = $blog->getAdministrator(); // lazy proxy
$administrator->setName(‘changed’);
$administratorRepository->update($administrator);
UnknownObjectException (1249479819): The object of type
“…\Administrator” given to update must be persisted already,
but is new.
remove() silently does nothing: the record is not deleted and no
exception is thrown.
$administratorRepository->remove($blog->getAdministrator());
$persistenceManager->persistAll();
// fe_users record 3 is still not deleted
Updating the parent ($blogRepository->update($blog)) persists
changes on the related object correctly.
Cause: Session::hasObject() checks the identity map by object
instance. The DataMapper registers only the real instance that the
proxy resolves to, never the proxy itself. So isNewObject() returns
true and getIdentifierByObject() returns null for the proxy, and
the backend skips it on remove.
Expected: A lazy proxy created by the DataMapper is treated as the
persisted object it stands for, without initializing an
uninitialized proxy (its uid is already set).
Reviews 2
Related issues 1
History 24
-
Alexander Schnitzler changed Related to #94486 <span data-processor="relativetime" data-value="2026-10-19T06:22:59+00:00" > 10/19/26, 06:22 </span>
-
Gerrit Code Review pushed patch set 1 for main to change 96849 status
NewUnder Review <span data-processor="relativetime" data-value="2026-10-19T06:39:47+00:00" > 10/19/26, 06:39 </span> -
Gerrit Code Review pushed patch set 2 for main to change 96849 <span data-processor="relativetime" data-value="2026-10-19T06:56:08+00:00" > 10/19/26, 06:56 </span>
-
Anonymous commented and changed status
Under ReviewResolved done0 %100 % <span data-processor="relativetime" data-value="2026-10-23T05:20:12+00:00" > 10/23/26, 05:20 </span>
Applied in changeset commit:b74a24ceefffff900ecdb133e9b25e682f9f3bca.