src/Entity/ProjectBranches.php line 22

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