From 6415f7fd85efc3dadba1d7be2d1d7b39df9a6526 Mon Sep 17 00:00:00 2001 From: Oliver Klee Date: Wed, 21 Jun 2023 20:40:51 +0200 Subject: [PATCH] [FEATURE] Add validation to the FE-editable tea properties (#866) The maximum length of the string fields ensures that the contents fit within the limits of the corresponding DB columns. --- Classes/Domain/Model/Product/Tea.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Classes/Domain/Model/Product/Tea.php b/Classes/Domain/Model/Product/Tea.php index 93ee208..9060a55 100644 --- a/Classes/Domain/Model/Product/Tea.php +++ b/Classes/Domain/Model/Product/Tea.php @@ -4,7 +4,7 @@ declare(strict_types=1); namespace TTN\Tea\Domain\Model\Product; -use TYPO3\CMS\Extbase\Annotation\ORM\Lazy; +use TYPO3\CMS\Extbase\Annotation as Extbase; use TYPO3\CMS\Extbase\Domain\Model\FileReference; use TYPO3\CMS\Extbase\DomainObject\AbstractEntity; use TYPO3\CMS\Extbase\Persistence\Generic\LazyLoadingProxy; @@ -14,14 +14,21 @@ use TYPO3\CMS\Extbase\Persistence\Generic\LazyLoadingProxy; */ class Tea extends AbstractEntity { + /** + * @Extbase\Validate("StringLength", options={"maximum": 255}) + * @Extbase\Validate("NotEmpty") + */ protected string $title = ''; + /** + * @Extbase\Validate("StringLength", options={"maximum": 2000}) + */ protected string $description = ''; /** * @var FileReference|null * @phpstan-var FileReference|LazyLoadingProxy|null - * @Lazy + * @Extbase\ORM\Lazy */ protected $image;