diff --git a/Classes/Domain/Model/Order/AbstractAddress.php b/Classes/Domain/Model/Order/AbstractAddress.php index 0307e54b..8906247b 100755 --- a/Classes/Domain/Model/Order/AbstractAddress.php +++ b/Classes/Domain/Model/Order/AbstractAddress.php @@ -11,11 +11,14 @@ * LICENSE file that was distributed with this source code. */ +use TYPO3\CMS\Extbase\Annotation\ORM\Lazy; use TYPO3\CMS\Extbase\DomainObject\AbstractEntity; +use TYPO3\CMS\Extbase\Persistence\Generic\LazyLoadingProxy; abstract class AbstractAddress extends AbstractEntity { - protected ?Item $item = null; + #[Lazy] + protected LazyLoadingProxy|Item|null $item = null; protected string $title = ''; @@ -72,6 +75,10 @@ public function toArray(): array public function getItem(): ?Item { + if ($this->item instanceof LazyLoadingProxy) { + $this->item->_loadRealInstance(); + } + return $this->item; } diff --git a/Classes/Domain/Model/Order/AbstractService.php b/Classes/Domain/Model/Order/AbstractService.php index 535f028f..52afb128 100644 --- a/Classes/Domain/Model/Order/AbstractService.php +++ b/Classes/Domain/Model/Order/AbstractService.php @@ -11,12 +11,15 @@ * LICENSE file that was distributed with this source code. */ +use TYPO3\CMS\Extbase\Annotation\ORM\Lazy; use TYPO3\CMS\Extbase\Annotation\Validate; use TYPO3\CMS\Extbase\DomainObject\AbstractEntity; +use TYPO3\CMS\Extbase\Persistence\Generic\LazyLoadingProxy; abstract class AbstractService extends AbstractEntity { - protected ?Item $item = null; + #[Lazy] + protected LazyLoadingProxy|Item|null $item = null; protected string $serviceCountry = ''; @@ -65,6 +68,10 @@ public function toArray(): array public function getItem(): ?Item { + if ($this->item instanceof LazyLoadingProxy) { + $this->item->_loadRealInstance(); + } + return $this->item; } diff --git a/Classes/Domain/Model/Order/Discount.php b/Classes/Domain/Model/Order/Discount.php index 88c1c727..0c08964d 100644 --- a/Classes/Domain/Model/Order/Discount.php +++ b/Classes/Domain/Model/Order/Discount.php @@ -12,12 +12,15 @@ */ use Extcode\Cart\Domain\Model\Cart\TaxClass; +use TYPO3\CMS\Extbase\Annotation\ORM\Lazy; use TYPO3\CMS\Extbase\Annotation\Validate; use TYPO3\CMS\Extbase\DomainObject\AbstractEntity; +use TYPO3\CMS\Extbase\Persistence\Generic\LazyLoadingProxy; class Discount extends AbstractEntity { - protected Item $item; + #[Lazy] + protected LazyLoadingProxy|Item $item; public function __construct( #[Validate(['validator' => 'NotEmpty'])] @@ -36,6 +39,10 @@ public function __construct( public function getItem(): ?Item { + if ($this->item instanceof LazyLoadingProxy) { + $this->item->_loadRealInstance(); + } + return $this->item; } diff --git a/Classes/Domain/Model/Order/Product.php b/Classes/Domain/Model/Order/Product.php index e5623148..2d860ab7 100644 --- a/Classes/Domain/Model/Order/Product.php +++ b/Classes/Domain/Model/Order/Product.php @@ -11,13 +11,16 @@ * LICENSE file that was distributed with this source code. */ +use TYPO3\CMS\Extbase\Annotation\ORM\Lazy; use TYPO3\CMS\Extbase\Annotation\Validate; use TYPO3\CMS\Extbase\DomainObject\AbstractEntity; +use TYPO3\CMS\Extbase\Persistence\Generic\LazyLoadingProxy; use TYPO3\CMS\Extbase\Persistence\ObjectStorage; class Product extends AbstractEntity { - protected Item $item; + #[Lazy] + protected LazyLoadingProxy|Item $item; protected int $productId = 0; @@ -74,6 +77,10 @@ protected function initStorageObjects(): void public function getItem(): ?Item { + if ($this->item instanceof LazyLoadingProxy) { + $this->item->_loadRealInstance(); + } + return $this->item; } diff --git a/Documentation/guides.xml b/Documentation/guides.xml index 240cf0fa..2b15ffec 100644 --- a/Documentation/guides.xml +++ b/Documentation/guides.xml @@ -11,8 +11,8 @@ interlink-shortcode="extcode/cart" /> diff --git a/ext_emconf.php b/ext_emconf.php index a6d58bcb..9baa6caa 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -4,7 +4,7 @@ 'title' => 'Cart', 'description' => 'Shopping Cart(s) for TYPO3', 'category' => 'plugin', - 'version' => '10.2.12', + 'version' => '10.3.0', 'state' => 'stable', 'author' => 'Daniel Gohlke', 'author_email' => 'ext@extco.de',