<?php
declare(strict_types=1);
namespace App\Entity;
use App\Enum\ServiceCode;
use App\Repository\ServiceRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* Сервисы (сайты) для Нотариусов, Партнеров, Юристов...
* определять на каких сервисах зарегистрированы пользователи
*
* @ORM\Entity(repositoryClass=ServiceRepository::class)
*/
class Service
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer", nullable=false)
*/
private ?int $id = null;
/**
* @ORM\Column(type="string", length=255, nullable=false)
*/
private string $name;
/**
* @ORM\Column(type="string", length=255, nullable=false)
*/
private string $code;
/**
* @ORM\OneToMany(targetEntity=Domain::class, mappedBy="service")
*/
private Collection $domains;
/**
* @ORM\OneToMany(targetEntity=Notary::class, mappedBy="service")
*/
private Collection $notaries;
/**
* @ORM\OneToMany(targetEntity=Partner::class, mappedBy="service")
*/
private Collection $partners;
/**
* @ORM\OneToMany(targetEntity=ServiceSectionGroup::class, mappedBy="service")
*/
private Collection $serviceSectionGroups;
public function __construct()
{
$this->domains = new ArrayCollection();
$this->notaries = new ArrayCollection();
$this->partners = new ArrayCollection();
$this->serviceSectionGroups = 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 getCode(): ServiceCode
{
return ServiceCode::from($this->code);
}
public function setCode(ServiceCode $code): self
{
$this->code = $code->value;
return $this;
}
public function getDomains(): Collection
{
return $this->domains;
}
public function getNotaries(): Collection
{
return $this->notaries;
}
public function getPartners(): Collection
{
return $this->partners;
}
/**
* @return Collection<ServiceSectionGroup>
*/
public function getServiceSectionGroups(): Collection
{
return $this->serviceSectionGroups;
}
}