events/Classes/Domain/Model/Category.php
Daniel Siepmann 27ee70d0cf
Add event to modify categories during destination.one import (#34)
A new PSR-14 event is added that allows to modify the categories to be
assigned to an event.
The event itself (including already existing categories) as well as the
list of categories to be used after import are available.
It is possible to change the categories to be assigned, e.g. keep some
of the existing categories.

That way it is possible for installations to add custom categories to
events.

Relates: #10623
2023-08-14 12:09:28 +02:00

73 lines
1.3 KiB
PHP

<?php
namespace Wrm\Events\Domain\Model;
use TYPO3\CMS\Extbase\Annotation as Extbase;
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
{
/**
* @var string
*/
protected $title = '';
/**
* @var int
*/
protected $sorting = 0;
/**
* @var bool
*/
protected $hidden = false;
/**
* @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;
}
public function getSorting(): int
{
return $this->sorting;
}
/**
* @return Category|null
*/
public function getParent()
{
if ($this->parent instanceof LazyLoadingProxy) {
$this->parent->_loadRealInstance();
}
return $this->parent;
}
}