src/Entity/CRM/Position.php line 11

  1. <?php
  2. namespace App\Entity\CRM;
  3. use App\Repository\PositionRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassPositionRepository::class)]
  8. class Position
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column]
  13.     private ?int $id null;
  14.     #[ORM\Column(length255)]
  15.     private ?string $name null;
  16.     #[ORM\OneToMany(mappedBy'position'targetEntityConsultant::class)]
  17.     private Collection $consultants;
  18.     #[ORM\OneToMany(mappedBy'position'targetEntityAdmin::class)]
  19.     private Collection $admins;
  20.     #[ORM\Column]
  21.     private ?bool $isActive null;
  22.     public function __construct()
  23.     {
  24.         $this->consultants = new ArrayCollection();
  25.         $this->admins = new ArrayCollection();
  26.     }
  27.     public function __toString(): string
  28.     {
  29.         return $this->name;
  30.     }
  31.     public function getId(): ?int
  32.     {
  33.         return $this->id;
  34.     }
  35.     public function getName(): ?string
  36.     {
  37.         return $this->name;
  38.     }
  39.     public function setName(string $name): static
  40.     {
  41.         $this->name $name;
  42.         return $this;
  43.     }
  44.     /**
  45.      * @return Collection<int, Consultant>
  46.      */
  47.     public function getConsultants(): Collection
  48.     {
  49.         return $this->consultants;
  50.     }
  51.     public function addConsultant(Consultant $consultant): static
  52.     {
  53.         if (!$this->consultants->contains($consultant)) {
  54.             $this->consultants->add($consultant);
  55.             $consultant->setPosition($this);
  56.         }
  57.         return $this;
  58.     }
  59.     public function removeConsultant(Consultant $consultant): static
  60.     {
  61.         if ($this->consultants->removeElement($consultant)) {
  62.             // set the owning side to null (unless already changed)
  63.             if ($consultant->getPosition() === $this) {
  64.                 $consultant->setPosition(null);
  65.             }
  66.         }
  67.         return $this;
  68.     }
  69.     /**
  70.      * @return Collection<int, Admin>
  71.      */
  72.     public function getAdmins(): Collection
  73.     {
  74.         return $this->admins;
  75.     }
  76.     public function addAdmin(Admin $admin): static
  77.     {
  78.         if (!$this->admins->contains($admin)) {
  79.             $this->admins->add($admin);
  80.             $admin->setPosition($this);
  81.         }
  82.         return $this;
  83.     }
  84.     public function removeAdmin(Admin $admin): static
  85.     {
  86.         if ($this->admins->removeElement($admin)) {
  87.             // set the owning side to null (unless already changed)
  88.             if ($admin->getPosition() === $this) {
  89.                 $admin->setPosition(null);
  90.             }
  91.         }
  92.         return $this;
  93.     }
  94.     public function isIsActive(): ?bool
  95.     {
  96.         return $this->isActive;
  97.     }
  98.     public function setIsActive(bool $isActive): static
  99.     {
  100.         $this->isActive $isActive;
  101.         return $this;
  102.     }
  103. }