mirror of https://github.com/FriendsOfTYPO3/tea.git synced 2024-11-22 14:16:12 +01:00

[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.
This commit is contained in:
Oliver Klee 2023-06-21 20:40:51 +02:00 committed by GitHub
parent ea915289df
commit 6415f7fd85
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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;