ew_bloggy/Classes/Domain/Model/Category.php
2025-01-21 20:22:57 +01:00

103 lines
2.1 KiB
PHP

<?php
declare(strict_types=1);
/*
* This file is developed by evoWeb.
*
* 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.
*/
namespace Evoweb\EwBloggy\Domain\Model;
use Evoweb\EwBloggy\Constants;
use TYPO3\CMS\Extbase\Annotation as Extbase;
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
use TYPO3\CMS\Extbase\Persistence\ObjectStorage;
use TYPO3\CMS\Extbase\Persistence\Generic\LazyLoadingProxy;
class Category extends AbstractEntity
{
protected string $title = '';
protected string $description = '';
protected int $recordType = Constants::CATEGORY_TYPE_BLOG;
#[Extbase\ORM\Lazy]
protected Category|LazyLoadingProxy|null $parent;
/**
* @var ObjectStorage<Post>
*/
#[Extbase\ORM\Lazy]
protected ObjectStorage $posts;
public function __construct()
{
$this->initializeObject();
}
public function initializeObject(): void
{
$this->posts = new ObjectStorage();
}
/**
* @return ObjectStorage<Post>
*/
public function getPosts(): ObjectStorage
{
return $this->posts;
}
/**
* @param ObjectStorage<Post> $posts
*/
public function setPosts(ObjectStorage $posts): void
{
$this->posts = $posts;
}
public function getRecordType(): int
{
return $this->recordType;
}
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): self
{
$this->description = $description;
return $this;
}
public function getParent(): ?self
{
return $this->parent;
}
public function setParent(self $parent): void
{
$this->parent = $parent;
}
}