src/Entity/Service.php line 19

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Entity;
  4. use App\Enum\ServiceCode;
  5. use App\Repository\ServiceRepository;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\Common\Collections\Collection;
  8. use Doctrine\ORM\Mapping as ORM;
  9. /**
  10.  * Сервисы (сайты) для Нотариусов, Партнеров, Юристов...
  11.  * определять на каких сервисах зарегистрированы пользователи
  12.  *
  13.  * @ORM\Entity(repositoryClass=ServiceRepository::class)
  14.  */
  15. class Service
  16. {
  17.     /**
  18.      * @ORM\Id
  19.      * @ORM\GeneratedValue
  20.      * @ORM\Column(type="integer", nullable=false)
  21.      */
  22.     private ?int $id null;
  23.     /**
  24.      * @ORM\Column(type="string", length=255, nullable=false)
  25.      */
  26.     private string $name;
  27.     /**
  28.      * @ORM\Column(type="string", length=255, nullable=false)
  29.      */
  30.     private string $code;
  31.     /**
  32.      * @ORM\OneToMany(targetEntity=Domain::class, mappedBy="service")
  33.      */
  34.     private Collection $domains;
  35.     /**
  36.      * @ORM\OneToMany(targetEntity=Notary::class, mappedBy="service")
  37.      */
  38.     private Collection $notaries;
  39.     /**
  40.      * @ORM\OneToMany(targetEntity=Partner::class, mappedBy="service")
  41.      */
  42.     private Collection $partners;
  43.     /**
  44.      * @ORM\OneToMany(targetEntity=ServiceSectionGroup::class, mappedBy="service")
  45.      */
  46.     private Collection $serviceSectionGroups;
  47.     public function __construct()
  48.     {
  49.         $this->domains = new ArrayCollection();
  50.         $this->notaries = new ArrayCollection();
  51.         $this->partners = new ArrayCollection();
  52.         $this->serviceSectionGroups = new ArrayCollection();
  53.     }
  54.     public function getId(): ?int
  55.     {
  56.         return $this->id;
  57.     }
  58.     public function getName(): string
  59.     {
  60.         return $this->name;
  61.     }
  62.     public function setName(string $name): self
  63.     {
  64.         $this->name $name;
  65.         return $this;
  66.     }
  67.     public function getCode(): ServiceCode
  68.     {
  69.         return ServiceCode::from($this->code);
  70.     }
  71.     public function setCode(ServiceCode $code): self
  72.     {
  73.         $this->code $code->value;
  74.         return $this;
  75.     }
  76.     public function getDomains(): Collection
  77.     {
  78.         return $this->domains;
  79.     }
  80.     public function getNotaries(): Collection
  81.     {
  82.         return $this->notaries;
  83.     }
  84.     public function getPartners(): Collection
  85.     {
  86.         return $this->partners;
  87.     }
  88.     /**
  89.      * @return Collection<ServiceSectionGroup>
  90.      */
  91.     public function getServiceSectionGroups(): Collection
  92.     {
  93.         return $this->serviceSectionGroups;
  94.     }
  95. }