events/Classes/Domain/Model/Category.php
Daniel Siepmann 81065f5c67
BREAKING: TYPO3 v12 support (#44)
* Migrated all fixtures to PHP.
* Removed version specific adjustments.
2023-11-27 10:04:42 +01:00

54 lines
1 KiB
PHP

<?php
declare(strict_types=1);
namespace WerkraumMedia\Events\Domain\Model;
use TYPO3\CMS\Extbase\Annotation\ORM\Lazy;
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
use TYPO3\CMS\Extbase\Persistence\Generic\LazyLoadingProxy;
/**
* Extend original model to include furher properties.
*
* Used for Plugins and Import.
*/
class Category extends AbstractEntity
{
protected int $sorting = 0;
/**
* @var Category|null
*/
#[Lazy]
protected $parent;
public function __construct(
?Category $parent,
int $pid,
protected string $title,
protected bool $hidden
) {
$this->parent = $parent;
$this->pid = $pid;
}
public function getTitle(): string
{
return $this->title;
}
public function getSorting(): int
{
return $this->sorting;
}
public function getParent(): ?Category
{
if ($this->parent instanceof LazyLoadingProxy) {
$this->parent->_loadRealInstance();
}
return $this->parent;
}
}