2021-03-23 16:34:38 +01:00
|
|
|
<?php
|
|
|
|
|
2023-11-27 10:04:42 +01:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2023-11-09 10:27:43 +01:00
|
|
|
namespace WerkraumMedia\Events\Domain\Model;
|
2021-03-23 16:34:38 +01:00
|
|
|
|
2023-11-27 10:04:42 +01:00
|
|
|
use TYPO3\CMS\Extbase\Annotation\ORM\Lazy;
|
2023-08-14 12:09:28 +02:00
|
|
|
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
|
|
|
|
use TYPO3\CMS\Extbase\Persistence\Generic\LazyLoadingProxy;
|
2021-03-23 16:34:38 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Extend original model to include furher properties.
|
2022-07-05 14:08:14 +02:00
|
|
|
*
|
|
|
|
* Used for Plugins and Import.
|
2021-03-23 16:34:38 +01:00
|
|
|
*/
|
2023-08-14 12:09:28 +02:00
|
|
|
class Category extends AbstractEntity
|
2021-03-23 16:34:38 +01:00
|
|
|
{
|
2023-11-27 10:04:42 +01:00
|
|
|
protected int $sorting = 0;
|
2022-07-05 14:08:14 +02:00
|
|
|
|
2023-08-14 12:09:28 +02:00
|
|
|
/**
|
|
|
|
* @var Category|null
|
|
|
|
*/
|
2023-11-27 10:04:42 +01:00
|
|
|
#[Lazy]
|
2023-08-14 12:09:28 +02:00
|
|
|
protected $parent;
|
|
|
|
|
|
|
|
public function __construct(
|
2023-11-27 10:04:42 +01:00
|
|
|
?Category $parent,
|
2023-08-14 12:09:28 +02:00
|
|
|
int $pid,
|
2023-11-27 10:04:42 +01:00
|
|
|
protected string $title,
|
|
|
|
protected bool $hidden
|
2023-08-14 12:09:28 +02:00
|
|
|
) {
|
|
|
|
$this->parent = $parent;
|
|
|
|
$this->pid = $pid;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getTitle(): string
|
|
|
|
{
|
|
|
|
return $this->title;
|
|
|
|
}
|
|
|
|
|
2021-03-23 16:34:38 +01:00
|
|
|
public function getSorting(): int
|
|
|
|
{
|
|
|
|
return $this->sorting;
|
|
|
|
}
|
2022-07-05 14:08:14 +02:00
|
|
|
|
2023-11-27 10:04:42 +01:00
|
|
|
public function getParent(): ?Category
|
2022-07-05 14:08:14 +02:00
|
|
|
{
|
2023-08-14 12:09:28 +02:00
|
|
|
if ($this->parent instanceof LazyLoadingProxy) {
|
|
|
|
$this->parent->_loadRealInstance();
|
|
|
|
}
|
|
|
|
return $this->parent;
|
2022-07-05 14:08:14 +02:00
|
|
|
}
|
2021-03-23 16:34:38 +01:00
|
|
|
}
|