Project

General

Profile

Actions

Bug #94486

open

Update Model with LazyLoadingProzy

Added by varioous OG almost 3 years ago. Updated almost 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 #1

Updated by varioous OG almost 3 years ago

  • Project changed from 9 to TYPO3 Core
  • Subject changed from Update Model iwth LazyLoadingProzy to Update Model with LazyLoadingProzy
  • TYPO3 Version set to 10
  • PHP Version set to 7.4
  • Tags set to repository
  • Complexity set to easy
Actions

Also available in: Atom PDF