Project

General

Profile

Actions

Bug #99408

closed

@Extbase\ORM\Lazy generate an error if I use type property

Added by Florian Rival almost 2 years ago. Updated almost 2 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Extbase
Target version:
Start date:
2022-12-21
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
11
PHP Version:
8.0
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

If I try to use Lazy loading with a property like that :

/**
 * @var ?Eventtype
 * @Extbase\ORM\Lazy
 */
protected Eventtype $eventType;

Then I have this error message :

Cannot assign TYPO3\CMS\Extbase\Persistence\Generic\LazyLoadingProxy to property Site\SiteNews\Domain\Model\News::$eventType of type Site\SiteNews\Domain\Model\Eventtype

If I remove the type, then the error disappears :

/**
 * @var ?Eventtype
 * @Extbase\ORM\Lazy
 */
protected $eventType;

Actions #1

Updated by Florian Rival almost 2 years ago

Have to add the LazyLoadingProxy in types and then it works :

    /**
     * @var ?Eventtype
     * @Extbase\ORM\Lazy
     */
    protected LazyLoadingProxy|Eventtype|null $eventType = null;

You can close this issue.

Actions #2

Updated by Chris Müller almost 2 years ago

  • Status changed from New to Closed
Actions

Also available in: Atom PDF