<?phpnamespace App\Entity;use App\Entity\Traits\LinkTrait;use App\Entity\Traits\MetaTrait;use Doctrine\ORM\Mapping as ORM;use App\Entity\Traits\ActiveTrait;use App\Entity\Traits\DeleteTrait;use App\Repository\SectorRepository;use App\Entity\Traits\SortOrderTrait;use Gedmo\Mapping\Annotation as Gedmo;// use App\Entity\Traits\TranslateTrait;use App\Entity\Traits\ImageUploadTrait;use App\Entity\Traits\SecondContentTrait;use Doctrine\Common\Collections\Criteria;use App\Entity\Traits\TitleAndContentTrait;use Doctrine\Common\Collections\Collection;use App\Entity\Traits\ThirdImageUploadTrait;use App\Entity\Traits\SecondImageUploadTrait;use App\Entity\Interfaces\DefaultLinkedEntity;use App\Entity\Traits\FeaturedTrait;use Doctrine\Common\Collections\ArrayCollection;use Gedmo\Timestampable\Traits\TimestampableEntity;/** * @Gedmo\Loggable */#[ORM\Entity(repositoryClass: SectorRepository::class)]class Sector implements DefaultLinkedEntity{ use TitleAndContentTrait; use SecondContentTrait; use LinkTrait; use ImageUploadTrait; use SecondImageUploadTrait; use MetaTrait; use SortOrderTrait; use ActiveTrait; use DeleteTrait; use TimestampableEntity; use FeaturedTrait; #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column(type:"integer")] private $id; #[ORM\ManyToOne(targetEntity: self::class, inversedBy: 'children')] private $parent; #[ORM\OneToMany(mappedBy: 'parent', targetEntity: self::class)] private $children; #[ORM\Column(type: 'string', length: 255, nullable: true)] private $iconClass; #[ORM\Column(type: 'text', nullable: true)] private $excerpt; public function __construct() { $this->children = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getLinkedPageId(): int { return 17; } public function getParent(): ?self { return $this->parent; } public function setParent(?self $parent): self { $this->parent = $parent; return $this; } /** * @return Collection<int, self> */ public function getChildren(): Collection { return $this->children; } public function addChild(self $child): self { if (!$this->children->contains($child)) { $this->children[] = $child; $child->setParent($this); } return $this; } public function removeChild(self $child): self { if ($this->children->removeElement($child)) { // set the owning side to null (unless already changed) if ($child->getParent() === $this) { $child->setParent(null); } } return $this; } public function getActiveChildren(): Collection { $criteria = Criteria::create() ->andWhere(Criteria::expr()->eq('active', true)) ->andWhere(Criteria::expr()->eq('deleted', false)); return $this->children->matching($criteria); } public function getIconClass(): ?string { return $this->iconClass; } public function setIconClass(?string $iconClass): self { $this->iconClass = $iconClass; return $this; } public function getExcerpt(): ?string { return $this->excerpt; } public function setExcerpt(?string $excerpt): self { $this->excerpt = $excerpt; return $this; }}