<?php
namespace App\Entity;
use App\Repository\ProjectBranchesRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\ORM\Mapping\UniqueConstraint;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* @ORM\Entity(repositoryClass=ProjectBranchesRepository::class)
* @ORM\Table(name="project_branches", uniqueConstraints={
* @UniqueConstraint(name="unique_project_branch", columns={"branch_id", "project_id"})
* })
*/
class ProjectBranches
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
* @Groups({
* "project.branches",
* "customer.selected.project",
* "stakeholder.selected.core.project.manage",
* "worker.manage.joined.projects",
* "worker.manage.selected.worker.in.project",
* "selected.customer.project.for.worker",
* "worker.manage.base.timesheet.payments",
*
* "project.branches.base",
*
* "project.branches.core",
*
* })
*/
private $id;
/**
* @ORM\ManyToOne(targetEntity=Projects::class, inversedBy="project_branches")
* ORM\JoinColumn(nullable=true, onDelete="CASCADE", name="project_id", referencedColumnName="id")
*/
private $project;
/**
* @ORM\ManyToOne(targetEntity=Branches::class, inversedBy="projectBranches")
* @Groups({
* "project.branches",
* "customer.selected.project",
* "stakeholder.selected.core.project.manage",
* "worker.manage.joined.projects",
* "worker.manage.selected.worker.in.project",
* "selected.customer.project.for.worker",
* "worker.manage.base.timesheet.payments",
*
* "project.branches.branch",
*
* })
*/
private $branch;
/**
* @ORM\ManyToMany(targetEntity=WorkerInProject::class, mappedBy="assigned_project_branches")
*/
private $workerInProjects;
/**
* @ORM\ManyToMany(targetEntity=WorkerInProject::class, mappedBy="project_branches_team_leader")
*/
private $project_branch_team_leaders;
/**
* @ORM\OneToMany(targetEntity=WorkerTimesheetPayments::class, mappedBy="project_branch")
*/
private $workerTimesheetPayments;
public function __construct()
{
$this->workerInProjects = new ArrayCollection();
$this->project_branch_team_leaders = new ArrayCollection();
$this->workerTimesheetPayments = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getProject(): ?Projects
{
return $this->project;
}
public function setProject(?Projects $project): self
{
$this->project = $project;
return $this;
}
public function getBranch(): ?Branches
{
return $this->branch;
}
public function setBranch(?Branches $branch): self
{
$this->branch = $branch;
return $this;
}
/**
* @return Collection<int, WorkerInProject>
*/
public function getWorkerInProjects(): Collection
{
return $this->workerInProjects;
}
public function addWorkerInProject(WorkerInProject $workerInProject): self
{
if (!$this->workerInProjects->contains($workerInProject)) {
$this->workerInProjects[] = $workerInProject;
$workerInProject->addAssignedProjectBranch($this);
}
return $this;
}
public function removeWorkerInProject(WorkerInProject $workerInProject): self
{
if ($this->workerInProjects->removeElement($workerInProject)) {
$workerInProject->removeAssignedProjectBranch($this);
}
return $this;
}
/**
* @return Collection<int, WorkerInProject>
*/
public function getProjectBranchTeamLeaders(): Collection
{
return $this->project_branch_team_leaders;
}
public function addProjectBranchTeamLeader(WorkerInProject $projectBranchTeamLeader): self
{
if (!$this->project_branch_team_leaders->contains($projectBranchTeamLeader)) {
$this->project_branch_team_leaders[] = $projectBranchTeamLeader;
$projectBranchTeamLeader->addProjectBranchesTeamLeader($this);
}
return $this;
}
public function removeProjectBranchTeamLeader(WorkerInProject $projectBranchTeamLeader): self
{
if ($this->project_branch_team_leaders->removeElement($projectBranchTeamLeader)) {
$projectBranchTeamLeader->removeProjectBranchesTeamLeader($this);
}
return $this;
}
/**
* @return Collection<int, WorkerTimesheetPayments>
*/
public function getWorkerTimesheetPayments(): Collection
{
return $this->workerTimesheetPayments;
}
public function addWorkerTimesheetPayment(WorkerTimesheetPayments $workerTimesheetPayment): self
{
if (!$this->workerTimesheetPayments->contains($workerTimesheetPayment)) {
$this->workerTimesheetPayments[] = $workerTimesheetPayment;
$workerTimesheetPayment->setProjectBranch($this);
}
return $this;
}
public function removeWorkerTimesheetPayment(WorkerTimesheetPayments $workerTimesheetPayment): self
{
if ($this->workerTimesheetPayments->removeElement($workerTimesheetPayment)) {
// set the owning side to null (unless already changed)
if ($workerTimesheetPayment->getProjectBranch() === $this) {
$workerTimesheetPayment->setProjectBranch(null);
}
}
return $this;
}
}