<?phpnamespace App\Entity;use App\Entity\Interfaces\DefaultLinkedEntity;use App\Entity\Traits\ActiveTrait;use App\Entity\Traits\DeleteTrait;use App\Entity\Traits\LinkTrait;use App\Entity\Traits\MetaTrait;use App\Entity\Traits\TitleAndContentTrait;use App\Entity\Traits\TranslateTrait;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use Gedmo\Mapping\Annotation as Gedmo;use Gedmo\Timestampable\Traits\TimestampableEntity;use Symfony\Component\Validator\Constraints as Assert;/** * Catalog. * * @Gedmo\Loggable * * @Gedmo\TranslationEntity(class="App\Entity\CatalogCategoriesTranslations") */#[ORM\Entity(repositoryClass: \App\Repository\CatalogRepository::class)]#[ORM\Table(name: 'catalog_categories')]class CatalogCategories implements DefaultLinkedEntity{ use TitleAndContentTrait; use LinkTrait; use MetaTrait; use ActiveTrait; use DeleteTrait; use TimestampableEntity; use TranslateTrait; #[ORM\Column(name: 'id', type: 'integer')] #[ORM\Id] #[ORM\GeneratedValue(strategy: 'AUTO')] private readonly int $id; /** * @Gedmo\Translatable * * @Gedmo\Versioned */ #[Assert\NotBlank(message: 'The description should not be blank')] #[ORM\Column(name: 'description', type: 'text', nullable: true)] private ?string $description = null; #[ORM\OneToMany(targetEntity: 'CatalogProducts', mappedBy: 'category')] private Collection $products; #[ORM\ManyToOne(targetEntity: 'CatalogCategories')] #[ORM\JoinColumn(name: 'parent', unique: false, referencedColumnName: 'id', nullable: true)] private ?CatalogCategories $parent = null; /** * Constructor. */ public function __construct() { $this->products = new ArrayCollection(); } /** * Get id. * * @return int */ public function getId() { return $this->id; } /** * Set description. * * @param string $description * * @return CatalogCategories */ public function setDescription($description) { $this->description = $description; return $this; } /** * Get description. * * @return string */ public function getDescription() { return $this->description; } /** * Add products. * * @return CatalogCategories */ public function addProduct(CatalogProducts $products) { $this->products[] = $products; return $this; } /** * Remove products. */ public function removeProduct(CatalogProducts $products) { $this->products->removeElement($products); } /** * Get products. * * @return ArrayCollection */ public function getProducts() { return $this->products; } /** * Set parent. * * @return CatalogCategories */ public function setParent(CatalogCategories $parent = null) { $this->parent = $parent; return $this; } /** * Get parent. * * @return CatalogCategories */ public function getParent() { return $this->parent; } // REQUIRED BY THE META LINKS TRAIT public function getLinkedPageId(): int { // CW TODO _ SET THIS CORRECTLY return 0; }}