2021-03-23 16:34:38 +01:00
|
|
|
<?php
|
|
|
|
|
2023-11-09 10:27:43 +01:00
|
|
|
namespace WerkraumMedia\Events\Domain\Model;
|
2021-03-23 16:34:38 +01:00
|
|
|
|
2023-08-14 12:09:28 +02:00
|
|
|
use TYPO3\CMS\Extbase\Annotation as Extbase;
|
|
|
|
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-08-14 12:09:28 +02:00
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
protected $title = '';
|
|
|
|
|
2021-03-23 16:34:38 +01:00
|
|
|
/**
|
|
|
|
* @var int
|
|
|
|
*/
|
|
|
|
protected $sorting = 0;
|
|
|
|
|
2022-07-05 14:08:14 +02:00
|
|
|
/**
|
|
|
|
* @var bool
|
|
|
|
*/
|
|
|
|
protected $hidden = false;
|
|
|
|
|
2023-08-14 12:09:28 +02:00
|
|
|
/**
|
|
|
|
* @var Category|null
|
|
|
|
*
|
|
|
|
* @Extbase\ORM\Lazy
|
|
|
|
*/
|
|
|
|
protected $parent;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param Category|null $parent
|
|
|
|
*/
|
|
|
|
public function __construct(
|
|
|
|
$parent,
|
|
|
|
int $pid,
|
|
|
|
string $title,
|
|
|
|
bool $hidden
|
|
|
|
) {
|
|
|
|
$this->parent = $parent;
|
|
|
|
$this->pid = $pid;
|
|
|
|
$this->title = $title;
|
|
|
|
$this->hidden = $hidden;
|
|
|
|
}
|
|
|
|
|
|
|
|
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-08-14 12:09:28 +02:00
|
|
|
/**
|
|
|
|
* @return Category|null
|
|
|
|
*/
|
|
|
|
public function getParent()
|
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
|
|
|
}
|