<?phpnamespace App\Entity;use App\Enum\AssessmentDirectionCode;use App\Repository\ServiceSectionGroupRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;/** * @ORM\Entity(repositoryClass=ServiceSectionGroupRepository::class) */class ServiceSectionGroup{ public const LABELS = [ 'Оценка для Нотариальных действий' => 'Нотариальные действия', 'Оценка по месту востребования' => 'По месту востребования', ]; /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", length=255) */ private $name; /** * @ORM\Column(type="integer") */ private $sortNumber; /** * @ORM\OneToMany(targetEntity=ServiceSection::class, mappedBy="serviceSectionGroup") */ private $sections; /** * @ORM\Column(type="array") */ private $roles = []; /** * @ORM\Column(type="string", length=255) */ private $domain; /** * @ORM\Column(type="string", length=255, nullable=false) */ private string $code; /** * @ORM\ManyToOne(targetEntity=Service::class, inversedBy="serviceSectionGroups") * @ORM\JoinColumn(nullable=false) */ private Service $service; /** * @ORM\Column(type="boolean", nullable=true) */ private ?bool $isEnabled = true; public function __construct() { $this->sections = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getName(): ?string { return $this->name; } public function setName(string $name): self { $this->name = $name; return $this; } public function getSortNumber(): ?int { return $this->sortNumber; } public function setSortNumber(int $sortNumber): self { $this->sortNumber = $sortNumber; return $this; } /** * @return Collection|ServiceSection[] */ public function getSections(): Collection { return $this->sections; } public function addSection(ServiceSection $section): self { if (!$this->sections->contains($section)) { $this->sections[] = $section; $section->setServiceSectionGroup($this); } return $this; } public function removeSection(ServiceSection $section): self { if ($this->sections->contains($section)) { $this->sections->removeElement($section); // set the owning side to null (unless already changed) if ($section->getServiceSectionGroup() === $this) { $section->setServiceSectionGroup(null); } } return $this; } public function getRoles(): ?array { return $this->roles; } public function setRoles(array $roles): self { $this->roles = $roles; return $this; } public function getDomain(): ?string { return $this->domain; } public function setDomain(string $domain): self { $this->domain = $domain; return $this; } public function getCode(): AssessmentDirectionCode { return AssessmentDirectionCode::from($this->code); } public function setCode(AssessmentDirectionCode $code): self { $this->code = $code->value; return $this; } public function getService(): Service { return $this->service; } public function setService(Service $service): self { $this->service = $service; return $this; } public function isEnabled(): bool { return (bool)$this->isEnabled; } public function setIsEnabled(bool $isEnabled): self { $this->isEnabled = $isEnabled; return $this; } public function getLabel(): string { return static::LABELS[$this->name] ?? ''; }}