src/Entity/ProjectBranches.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ProjectBranchesRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Doctrine\ORM\Mapping\UniqueConstraint;
  8. use Symfony\Component\Serializer\Annotation\Groups;
  9. /**
  10.  * @ORM\Entity(repositoryClass=ProjectBranchesRepository::class)
  11.  * @ORM\Table(name="project_branches", uniqueConstraints={
  12.  *     @UniqueConstraint(name="unique_project_branch", columns={"branch_id", "project_id"})
  13.  *     })
  14.  */
  15. class ProjectBranches
  16. {
  17.     /**
  18.      * @ORM\Id
  19.      * @ORM\GeneratedValue
  20.      * @ORM\Column(type="integer")
  21.      * @Groups({
  22.      *     "project.branches",
  23.      *     "customer.selected.project",
  24.      *     "stakeholder.selected.core.project.manage",
  25.      *     "worker.manage.joined.projects",
  26.      *     "worker.manage.selected.worker.in.project",
  27.      *     "selected.customer.project.for.worker",
  28.      *     "worker.manage.base.timesheet.payments",
  29.      *
  30.      *     "project.branches.base",
  31.      *
  32.      *     "project.branches.core",
  33.      *
  34.      * })
  35.      */
  36.     private $id;
  37.     /**
  38.      * @ORM\ManyToOne(targetEntity=Projects::class, inversedBy="project_branches")
  39.      * ORM\JoinColumn(nullable=true, onDelete="CASCADE", name="project_id", referencedColumnName="id")
  40.      */
  41.     private $project;
  42.     /**
  43.      * @ORM\ManyToOne(targetEntity=Branches::class, inversedBy="projectBranches")
  44.      * @Groups({
  45.      *     "project.branches",
  46.      *     "customer.selected.project",
  47.      *     "stakeholder.selected.core.project.manage",
  48.      *     "worker.manage.joined.projects",
  49.      *     "worker.manage.selected.worker.in.project",
  50.      *     "selected.customer.project.for.worker",
  51.      *     "worker.manage.base.timesheet.payments",
  52.      *
  53.      *     "project.branches.branch",
  54.      *
  55.      * })
  56.      */
  57.     private $branch;
  58.     /**
  59.      * @ORM\ManyToMany(targetEntity=WorkerInProject::class, mappedBy="assigned_project_branches")
  60.      */
  61.     private $workerInProjects;
  62.     /**
  63.      * @ORM\ManyToMany(targetEntity=WorkerInProject::class, mappedBy="project_branches_team_leader")
  64.      */
  65.     private $project_branch_team_leaders;
  66.     /**
  67.      * @ORM\OneToMany(targetEntity=WorkerTimesheetPayments::class, mappedBy="project_branch")
  68.      */
  69.     private $workerTimesheetPayments;
  70.     public function __construct()
  71.     {
  72.         $this->workerInProjects = new ArrayCollection();
  73.         $this->project_branch_team_leaders = new ArrayCollection();
  74.         $this->workerTimesheetPayments = new ArrayCollection();
  75.     }
  76.     public function getId(): ?int
  77.     {
  78.         return $this->id;
  79.     }
  80.     public function getProject(): ?Projects
  81.     {
  82.         return $this->project;
  83.     }
  84.     public function setProject(?Projects $project): self
  85.     {
  86.         $this->project $project;
  87.         return $this;
  88.     }
  89.     public function getBranch(): ?Branches
  90.     {
  91.         return $this->branch;
  92.     }
  93.     public function setBranch(?Branches $branch): self
  94.     {
  95.         $this->branch $branch;
  96.         return $this;
  97.     }
  98.     /**
  99.      * @return Collection<int, WorkerInProject>
  100.      */
  101.     public function getWorkerInProjects(): Collection
  102.     {
  103.         return $this->workerInProjects;
  104.     }
  105.     public function addWorkerInProject(WorkerInProject $workerInProject): self
  106.     {
  107.         if (!$this->workerInProjects->contains($workerInProject)) {
  108.             $this->workerInProjects[] = $workerInProject;
  109.             $workerInProject->addAssignedProjectBranch($this);
  110.         }
  111.         return $this;
  112.     }
  113.     public function removeWorkerInProject(WorkerInProject $workerInProject): self
  114.     {
  115.         if ($this->workerInProjects->removeElement($workerInProject)) {
  116.             $workerInProject->removeAssignedProjectBranch($this);
  117.         }
  118.         return $this;
  119.     }
  120.     /**
  121.      * @return Collection<int, WorkerInProject>
  122.      */
  123.     public function getProjectBranchTeamLeaders(): Collection
  124.     {
  125.         return $this->project_branch_team_leaders;
  126.     }
  127.     public function addProjectBranchTeamLeader(WorkerInProject $projectBranchTeamLeader): self
  128.     {
  129.         if (!$this->project_branch_team_leaders->contains($projectBranchTeamLeader)) {
  130.             $this->project_branch_team_leaders[] = $projectBranchTeamLeader;
  131.             $projectBranchTeamLeader->addProjectBranchesTeamLeader($this);
  132.         }
  133.         return $this;
  134.     }
  135.     public function removeProjectBranchTeamLeader(WorkerInProject $projectBranchTeamLeader): self
  136.     {
  137.         if ($this->project_branch_team_leaders->removeElement($projectBranchTeamLeader)) {
  138.             $projectBranchTeamLeader->removeProjectBranchesTeamLeader($this);
  139.         }
  140.         return $this;
  141.     }
  142.     /**
  143.      * @return Collection<int, WorkerTimesheetPayments>
  144.      */
  145.     public function getWorkerTimesheetPayments(): Collection
  146.     {
  147.         return $this->workerTimesheetPayments;
  148.     }
  149.     public function addWorkerTimesheetPayment(WorkerTimesheetPayments $workerTimesheetPayment): self
  150.     {
  151.         if (!$this->workerTimesheetPayments->contains($workerTimesheetPayment)) {
  152.             $this->workerTimesheetPayments[] = $workerTimesheetPayment;
  153.             $workerTimesheetPayment->setProjectBranch($this);
  154.         }
  155.         return $this;
  156.     }
  157.     public function removeWorkerTimesheetPayment(WorkerTimesheetPayments $workerTimesheetPayment): self
  158.     {
  159.         if ($this->workerTimesheetPayments->removeElement($workerTimesheetPayment)) {
  160.             // set the owning side to null (unless already changed)
  161.             if ($workerTimesheetPayment->getProjectBranch() === $this) {
  162.                 $workerTimesheetPayment->setProjectBranch(null);
  163.             }
  164.         }
  165.         return $this;
  166.     }
  167. }