70 lines
1.6 KiB
PHP
70 lines
1.6 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
/*
|
|
* This file is part of the TYPO3 CMS project.
|
|
*
|
|
* It is free software; you can redistribute it and/or modify it under
|
|
* the terms of the GNU General Public License, either version 2
|
|
* of the License, or any later version.
|
|
*
|
|
* For the full copyright and license information, please read the
|
|
* LICENSE.txt file that was distributed with this source code.
|
|
*
|
|
* The TYPO3 project - inspiring people to share!
|
|
*/
|
|
|
|
namespace TYPO3\CMS\Extbase\Domain\Model;
|
|
|
|
use TYPO3\CMS\Extbase\Attribute as Extbase;
|
|
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
|
|
use TYPO3\CMS\Extbase\Persistence\Generic\LazyLoadingProxy;
|
|
|
|
/**
|
|
* This model represents a category (for anything).
|
|
*/
|
|
class Category extends AbstractEntity
|
|
{
|
|
#[Extbase\Validate(validator: 'NotEmpty')]
|
|
protected string $title = '';
|
|
|
|
protected string $description = '';
|
|
|
|
#[Extbase\ORM\Lazy]
|
|
protected Category|LazyLoadingProxy|null $parent = null;
|
|
|
|
public function getTitle(): string
|
|
{
|
|
return $this->title;
|
|
}
|
|
|
|
public function setTitle(string $title): void
|
|
{
|
|
$this->title = $title;
|
|
}
|
|
|
|
public function getDescription(): string
|
|
{
|
|
return $this->description;
|
|
}
|
|
|
|
public function setDescription(string $description): void
|
|
{
|
|
$this->description = $description;
|
|
}
|
|
|
|
public function getParent(): ?Category
|
|
{
|
|
if ($this->parent instanceof LazyLoadingProxy) {
|
|
$this->parent->_loadRealInstance();
|
|
}
|
|
return $this->parent;
|
|
}
|
|
|
|
public function setParent(Category $parent): void
|
|
{
|
|
$this->parent = $parent;
|
|
}
|
|
}
|