src/Entity/Department.php line 13

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. /**
  8.  * @ORM\Entity(repositoryClass=DepartmentRepository::class)
  9.  */
  10. class Department
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="string", length=255)
  20.      */
  21.     private $departmentName;
  22.     /**
  23.      * @ORM\ManyToOne(targetEntity=District::class, inversedBy="departments")
  24.      */
  25.     private $district;
  26.     /**
  27.      * @ORM\OneToMany(targetEntity=CompagnyInfo::class, mappedBy="departmentCompagny")
  28.      */
  29.     private $compagnyInfos;
  30.     /**
  31.      * @ORM\Column(type="string", length=3)
  32.      */
  33.     private $numberDepartment;
  34.     public function __construct()
  35.     {
  36.         $this->compagnyInfos = new ArrayCollection();
  37.     }
  38.     public function getId(): ?int
  39.     {
  40.         return $this->id;
  41.     }
  42.     public function getDepartmentName(): ?string
  43.     {
  44.         return $this->departmentName;
  45.     }
  46.     public function setDepartmentName(string $departmentName): self
  47.     {
  48.         $this->departmentName $departmentName;
  49.         return $this;
  50.     }
  51.     public function getDistrict(): ?District
  52.     {
  53.         return $this->district;
  54.     }
  55.     public function setDistrict(?District $district): self
  56.     {
  57.         $this->district $district;
  58.         return $this;
  59.     }
  60.     /**
  61.      * @return Collection|CompagnyInfo[]
  62.      */
  63.     public function getCompagnyInfos(): Collection
  64.     {
  65.         return $this->compagnyInfos;
  66.     }
  67.     public function addCompagnyInfo(CompagnyInfo $compagnyInfo): self
  68.     {
  69.         if (!$this->compagnyInfos->contains($compagnyInfo)) {
  70.             $this->compagnyInfos[] = $compagnyInfo;
  71.             $compagnyInfo->setDepartmentCompagny($this);
  72.         }
  73.         return $this;
  74.     }
  75.     public function removeCompagnyInfo(CompagnyInfo $compagnyInfo): self
  76.     {
  77.         if ($this->compagnyInfos->contains($compagnyInfo)) {
  78.             $this->compagnyInfos->removeElement($compagnyInfo);
  79.             // set the owning side to null (unless already changed)
  80.             if ($compagnyInfo->getDepartmentCompagny() === $this) {
  81.                 $compagnyInfo->setDepartmentCompagny(null);
  82.             }
  83.         }
  84.         return $this;
  85.     }
  86.     public function getNumberDepartment(): ?string
  87.     {
  88.         return $this->numberDepartment;
  89.     }
  90.     public function setNumberDepartment(string $numberDepartment): self
  91.     {
  92.         $this->numberDepartment $numberDepartment;
  93.         return $this;
  94.     }
  95. }