Project

General

Profile

Actions

Bug #94486

open

Update Model with LazyLoadingProzy

Added by varioous OG over 3 years ago. Updated over 3 years ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2021-07-06
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
10
PHP Version:
7.4
Tags:
repository
Complexity:
easy
Is Regression:
Sprint Focus:

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.

Actions

Also available in: Atom PDF