src/Entity/Department.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\DepartmentRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassDepartmentRepository::class)]
  8. class Department
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column(type'integer')]
  13.     private ?int $id;
  14.     #[ORM\Column(type'string'length180)]
  15.     private ?string $name;
  16.     #[ORM\Column(type'string'length255)]
  17.     private ?string $description;
  18.     #[ORM\Column(type'boolean'nullabletrue)]
  19.     private ?bool $isDeleted;
  20.     #[ORM\ManyToMany(targetEntityProfessionGroup::class)]
  21.     #[ORM\JoinTable(name'departments_profession_groups')]
  22.     private $professionGroups;
  23.     public function __construct()
  24.     {
  25.         $this->professionGroups = new ArrayCollection();
  26.     }
  27.     public function getId(): ?int
  28.     {
  29.         return $this->id;
  30.     }
  31.     public function getName(): ?string
  32.     {
  33.         return $this->name;
  34.     }
  35.     public function setName(string $name): self
  36.     {
  37.         $this->name $name;
  38.         return $this;
  39.     }
  40.     public function getDescription(): ?string
  41.     {
  42.         return $this->description;
  43.     }
  44.     public function setDescription(string $description): self
  45.     {
  46.         $this->description $description;
  47.         return $this;
  48.     }
  49.     public function isIsDeleted(): ?bool
  50.     {
  51.         return $this->isDeleted;
  52.     }
  53.     public function setIsDeleted(?bool $isDeleted): self
  54.     {
  55.         $this->isDeleted $isDeleted;
  56.         return $this;
  57.     }
  58.     /**
  59.      * @return Collection<int, ProfessionGroup>
  60.      */
  61.     public function getProfessionGroups(): Collection
  62.     {
  63.         return $this->professionGroups;
  64.     }
  65.     public function addProfessionGroup(ProfessionGroup $professionGroup): self
  66.     {
  67.         if (!$this->professionGroups->contains($professionGroup)) {
  68.             $this->professionGroups[] = $professionGroup;
  69.         }
  70.         return $this;
  71.     }
  72.     public function removeProfessionGroup(ProfessionGroup $professionGroup): self
  73.     {
  74.         $this->professionGroups->removeElement($professionGroup);
  75.         return $this;
  76.     }
  77. }