2018-05-25 16:19:12 +02:00
|
|
|
<?php
|
2019-12-07 12:13:32 +01:00
|
|
|
|
2019-08-12 17:25:59 +02:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2019-12-01 12:16:06 +01:00
|
|
|
namespace TTN\Tea\Domain\Model\Product;
|
2018-05-25 16:19:12 +02:00
|
|
|
|
2023-06-21 20:40:51 +02:00
|
|
|
use TYPO3\CMS\Extbase\Annotation as Extbase;
|
2018-05-25 22:39:33 +02:00
|
|
|
use TYPO3\CMS\Extbase\Domain\Model\FileReference;
|
2018-05-25 16:19:12 +02:00
|
|
|
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
|
2018-05-25 22:39:33 +02:00
|
|
|
use TYPO3\CMS\Extbase\Persistence\Generic\LazyLoadingProxy;
|
2018-05-25 16:19:12 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This class represents a tea (flavor), e.g., "Earl Grey".
|
|
|
|
*/
|
|
|
|
class Tea extends AbstractEntity
|
|
|
|
{
|
2023-06-21 20:40:51 +02:00
|
|
|
/**
|
|
|
|
* @Extbase\Validate("StringLength", options={"maximum": 255})
|
|
|
|
* @Extbase\Validate("NotEmpty")
|
|
|
|
*/
|
2022-10-03 19:00:55 +02:00
|
|
|
protected string $title = '';
|
2018-05-25 16:19:12 +02:00
|
|
|
|
2023-06-21 20:40:51 +02:00
|
|
|
/**
|
|
|
|
* @Extbase\Validate("StringLength", options={"maximum": 2000})
|
|
|
|
*/
|
2022-10-03 19:00:55 +02:00
|
|
|
protected string $description = '';
|
2018-05-25 16:19:12 +02:00
|
|
|
|
2018-05-25 22:39:33 +02:00
|
|
|
/**
|
2022-11-01 21:44:37 +01:00
|
|
|
* @var FileReference|null
|
2023-04-22 18:40:06 +02:00
|
|
|
* @phpstan-var FileReference|LazyLoadingProxy|null
|
2023-06-21 20:40:51 +02:00
|
|
|
* @Extbase\ORM\Lazy
|
2018-05-25 22:39:33 +02:00
|
|
|
*/
|
2021-11-17 13:14:43 +01:00
|
|
|
protected $image;
|
2018-05-25 22:39:33 +02:00
|
|
|
|
2023-11-27 15:44:16 +01:00
|
|
|
/**
|
|
|
|
* @var int
|
|
|
|
*/
|
|
|
|
protected $stars = null;
|
|
|
|
|
2023-06-21 09:16:13 +02:00
|
|
|
// Note: We cannot use `@var` for the more specific type annotation here as this confuses the Extbase type mapper.
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @phpstan-var int<0, max>
|
|
|
|
*/
|
|
|
|
protected int $ownerUid = 0;
|
|
|
|
|
2018-05-25 16:19:12 +02:00
|
|
|
public function getTitle(): string
|
|
|
|
{
|
|
|
|
return $this->title;
|
|
|
|
}
|
|
|
|
|
2019-08-12 17:25:59 +02:00
|
|
|
public function setTitle(string $title): void
|
2018-05-25 16:19:12 +02:00
|
|
|
{
|
|
|
|
$this->title = $title;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getDescription(): string
|
|
|
|
{
|
|
|
|
return $this->description;
|
|
|
|
}
|
|
|
|
|
2019-08-12 17:25:59 +02:00
|
|
|
public function setDescription(string $description): void
|
2018-05-25 16:19:12 +02:00
|
|
|
{
|
|
|
|
$this->description = $description;
|
|
|
|
}
|
2018-05-25 22:39:33 +02:00
|
|
|
|
2019-08-12 17:43:02 +02:00
|
|
|
public function getImage(): ?FileReference
|
2018-05-25 22:39:33 +02:00
|
|
|
{
|
|
|
|
if ($this->image instanceof LazyLoadingProxy) {
|
2021-09-22 22:34:58 +02:00
|
|
|
/** @var FileReference $image */
|
|
|
|
$image = $this->image->_loadRealInstance();
|
|
|
|
$this->image = $image;
|
2018-05-25 22:39:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return $this->image;
|
|
|
|
}
|
|
|
|
|
2019-08-12 17:25:59 +02:00
|
|
|
public function setImage(FileReference $image): void
|
2018-05-25 22:39:33 +02:00
|
|
|
{
|
|
|
|
$this->image = $image;
|
|
|
|
}
|
2023-06-21 09:16:13 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @return int<0, max>
|
|
|
|
*/
|
|
|
|
public function getOwnerUid(): int
|
|
|
|
{
|
|
|
|
return $this->ownerUid;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param int<0, max> $ownerUid
|
|
|
|
*/
|
|
|
|
public function setOwnerUid(int $ownerUid): void
|
|
|
|
{
|
|
|
|
$this->ownerUid = $ownerUid;
|
|
|
|
}
|
2023-11-27 15:44:16 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @return int|null
|
|
|
|
*/
|
|
|
|
public function getStars(): ?int
|
|
|
|
{
|
|
|
|
return $this->stars;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param int|null $stars
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function setStars(?int $stars): void
|
|
|
|
{
|
|
|
|
$this->stars = $stars;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-05-25 16:19:12 +02:00
|
|
|
}
|