mirror of https://github.com/FriendsOfTYPO3/tea.git synced 2024-11-10 00:36:13 +01:00

[CLEANUP] Make lazy-loading proxies visible via type annotations (#310)

Relates to #291
This commit is contained in:
Oliver Klee 2021-09-22 22:34:58 +02:00 committed by GitHub
parent 3939ad083e
commit 0816fad65b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -25,7 +25,8 @@ class Tea extends AbstractEntity
protected $description = '';
/**
* @var \TYPO3\CMS\Extbase\Domain\Model\FileReference
* @phpstan-var \TYPO3\CMS\Extbase\Domain\Model\FileReference|LazyLoadingProxy|null
* @var \TYPO3\CMS\Extbase\Domain\Model\FileReference|null
* @Lazy
*/
protected $image = null;
@ -53,7 +54,9 @@ class Tea extends AbstractEntity
public function getImage(): ?FileReference
{
if ($this->image instanceof LazyLoadingProxy) {
$this->image = $this->image->_loadRealInstance();
/** @var FileReference $image */
$image = $this->image->_loadRealInstance();
$this->image = $image;
}
return $this->image;