src/Entity/BranchDepartements.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\BranchDepartementsRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\Serializer\Annotation\Groups;
  8. use Doctrine\ORM\Mapping\UniqueConstraint;
  9. /**
  10.  * @ORM\Entity(repositoryClass=BranchDepartementsRepository::class)
  11.  * @ORM\Table(name="branch_departements", uniqueConstraints={
  12.  *             @UniqueConstraint(name="unique_branch_departements", columns={"branch_id", "name"})
  13.  *        })
  14.  */
  15. class BranchDepartements
  16. {
  17.     /**
  18.      * @ORM\Id
  19.      * @ORM\GeneratedValue
  20.      * @ORM\Column(type="integer")
  21.      * @Groups({
  22.      *     "branch.departement.core"
  23.      * })
  24.      */
  25.     private $id;
  26.     /**
  27.      * @ORM\ManyToOne(targetEntity=Branches::class, inversedBy="branchDepartements")
  28.      */
  29.     private $branch;
  30.     /**
  31.      * @ORM\Column(type="string", length=255)
  32.      * @Groups({
  33.      *      "branch.departement.core"
  34.      *  })
  35.      */
  36.     private $name;
  37.     /**
  38.      * @ORM\Column(type="string", length=255, nullable=true)
  39.      * @Groups({
  40.      *      "branch.departement.core"
  41.      *  })
  42.      */
  43.     private $description;
  44.     /**
  45.      * @ORM\OneToMany(targetEntity=ProjectOrders::class, mappedBy="branch_departement")
  46.      */
  47.     private $projectOrders;
  48.     /**
  49.      * @ORM\Column(type="datetime_immutable", nullable=true)
  50.      */
  51.     private $created_at;
  52.     public function __construct()
  53.     {
  54.         $this->projectOrders = new ArrayCollection();
  55.     }
  56.     public function getId(): ?int
  57.     {
  58.         return $this->id;
  59.     }
  60.     public function getBranch(): ?Branches
  61.     {
  62.         return $this->branch;
  63.     }
  64.     public function setBranch(?Branches $branch): self
  65.     {
  66.         $this->branch $branch;
  67.         return $this;
  68.     }
  69.     public function getName(): ?string
  70.     {
  71.         return $this->name;
  72.     }
  73.     public function setName(string $name): self
  74.     {
  75.         $this->name $name;
  76.         return $this;
  77.     }
  78.     public function getDescription(): ?string
  79.     {
  80.         return $this->description;
  81.     }
  82.     public function setDescription(?string $description): self
  83.     {
  84.         $this->description $description;
  85.         return $this;
  86.     }
  87.     /**
  88.      * @return Collection<int, ProjectOrders>
  89.      */
  90.     public function getProjectOrders(): Collection
  91.     {
  92.         return $this->projectOrders;
  93.     }
  94.     public function addProjectOrder(ProjectOrders $projectOrder): self
  95.     {
  96.         if (!$this->projectOrders->contains($projectOrder)) {
  97.             $this->projectOrders[] = $projectOrder;
  98.             $projectOrder->setBranchDepartement($this);
  99.         }
  100.         return $this;
  101.     }
  102.     public function removeProjectOrder(ProjectOrders $projectOrder): self
  103.     {
  104.         if ($this->projectOrders->removeElement($projectOrder)) {
  105.             // set the owning side to null (unless already changed)
  106.             if ($projectOrder->getBranchDepartement() === $this) {
  107.                 $projectOrder->setBranchDepartement(null);
  108.             }
  109.         }
  110.         return $this;
  111.     }
  112.     public function getCreatedAt(): ?\DateTimeImmutable
  113.     {
  114.         return $this->created_at;
  115.     }
  116.     public function setCreatedAt(?\DateTimeImmutable $created_at): self
  117.     {
  118.         $this->created_at $created_at;
  119.         return $this;
  120.     }
  121. }