<?php
namespace App\Entity;
use App\Entity\Base\AbstractTimestampableEntity;
use App\Repository\ProjectRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=ProjectRepository::class)
* @ORM\HasLifecycleCallbacks
*/
class Project extends AbstractTimestampableEntity
{
/**
* @ORM\Column(type="string", length=255)
*/
private $name;
/**
* @ORM\Column(type="float", nullable=true)
*/
private $price;
/**
* @ORM\Column(type="integer", nullable=false, options={"default"=0})
*/
private $scheduledHours=0;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $workedHours;
/**
* @ORM\Column(type="string", length=100, nullable=true)
*/
private $url;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $endDate;
/**
* @ORM\ManyToOne(targetEntity=Company::class, inversedBy="projects")
* @ORM\JoinColumn(nullable=false)
*/
private $company;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $description;
/**
* @ORM\ManyToOne(targetEntity=ProjectType::class)
* @ORM\JoinColumn(nullable=false)
*/
private $projectType;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $securityData;
/**
* @ORM\ManyToOne(targetEntity=ProjectStatus::class)
* @ORM\JoinColumn(nullable=false)
*/
private $status;
/**
* @ORM\Column(type="datetime")
*/
private $deadline;
/**
* @ORM\OneToMany(targetEntity=Offer::class, mappedBy="project")
*/
private $offers;
/**
* @ORM\OneToMany(targetEntity=Task::class, mappedBy="project")
*/
private $tasks;
/**
* @ORM\ManyToOne(targetEntity=Currency::class)
* @ORM\JoinColumn(nullable=false)
*/
private $currency;
/**
* @ORM\Column(type="decimal")
*/
private float $hourlyRate;
/**
* @ORM\OneToMany(targetEntity=Contract::class, mappedBy="project")
*/
private $contracts;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $contactPersonName;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $contactPersonEmail;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $contactPersonPhone;
/**
* @ORM\ManyToOne(targetEntity=User::class)
*/
private $projectManager;
/**
* @ORM\OneToMany(targetEntity=CashIn::class, mappedBy="project")
*/
private $cashIns;
/**
* @ORM\OneToMany(targetEntity=CashOut::class, mappedBy="project")
*/
private $cashOuts;
public function __construct()
{
$this->offers = new ArrayCollection();
$this->tasks = new ArrayCollection();
$this->contracts = new ArrayCollection();
$this->cashIns = new ArrayCollection();
$this->cashOuts = new ArrayCollection();
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getPrice(): ?float
{
return $this->price;
}
public function setPrice(?float $price): self
{
$this->price = $price;
return $this;
}
public function getScheduledHours(): int
{
return $this->scheduledHours;
}
public function setScheduledHours(int $scheduledHours): void
{
$this->scheduledHours = $scheduledHours;
}
public function getWorkedHours(): ?int
{
return $this->workedHours;
}
public function setWorkedHours(int $workedHours): self
{
$this->workedHours = $workedHours;
return $this;
}
public function getUrl(): ?string
{
return $this->url;
}
public function setUrl(?string $url): self
{
$this->url = $url;
return $this;
}
public function getEndDate(): ?\DateTimeInterface
{
return $this->endDate;
}
public function setEndDate(?\DateTimeInterface $endDate): self
{
$this->endDate = $endDate;
return $this;
}
public function getCompany(): ?Company
{
return $this->company;
}
public function setCompany(?Company $company): self
{
$this->company = $company;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getType(): ?ProjectType
{
return $this->projectType;
}
public function setType(?ProjectType $projectType): self
{
$this->projectType = $projectType;
return $this;
}
public function getProjectType()
{
return $this->projectType;
}
public function setProjectType($projectType): void
{
$this->projectType = $projectType;
}
public function getSecurityData()
{
return $this->securityData;
}
public function setSecurityData($securityData): void
{
$this->securityData = $securityData;
}
public function getStatus(): ?ProjectStatus
{
return $this->status;
}
public function setStatus(?ProjectStatus $status): self
{
$this->status = $status;
return $this;
}
public function getDeadline(): ?\DateTimeInterface
{
return $this->deadline;
}
public function setDeadline(\DateTimeInterface $deadline): self
{
$this->deadline = $deadline;
return $this;
}
/**
* @return Collection<int, Offer>
*/
public function getOffers(): Collection
{
return $this->offers;
}
public function addOffer(Offer $offer): self
{
if (!$this->offers->contains($offer)) {
$this->offers[] = $offer;
$offer->setProject($this);
}
return $this;
}
public function removeOffer(Offer $offer): self
{
if ($this->offers->removeElement($offer)) {
// set the owning side to null (unless already changed)
if ($offer->getProject() === $this) {
$offer->setProject(null);
}
}
return $this;
}
/**
* @return Collection<int, Task>
*/
public function getTasks(): Collection
{
return $this->tasks;
}
public function addTask(Task $task): self
{
if (!$this->tasks->contains($task)) {
$this->tasks[] = $task;
$task->setProject($this);
}
return $this;
}
public function removeTask(Task $task): self
{
if ($this->tasks->removeElement($task)) {
// set the owning side to null (unless already changed)
if ($task->getProject() === $this) {
$task->setProject(null);
}
}
return $this;
}
public function getCurrency()
{
return $this->currency;
}
public function setCurrency($currency): void
{
$this->currency = $currency;
}
public function getHourlyRate(): float
{
return $this->hourlyRate;
}
public function setHourlyRate(float $hourlyRate): void
{
$this->hourlyRate = $hourlyRate;
}
/**
* @return Collection<int, Contract>
*/
public function getContracts(): Collection
{
return $this->contracts;
}
public function addContract(Contract $contract): self
{
if (!$this->contracts->contains($contract)) {
$this->contracts[] = $contract;
$contract->setProject($this);
}
return $this;
}
public function removeContract(Contract $contract): self
{
if ($this->contracts->removeElement($contract)) {
// set the owning side to null (unless already changed)
if ($contract->getProject() === $this) {
$contract->setProject(null);
}
}
return $this;
}
public function getContactPersonName(): ?string
{
return $this->contactPersonName;
}
public function setContactPersonName(?string $contactPersonName): self
{
$this->contactPersonName = $contactPersonName;
return $this;
}
public function getContactPersonEmail(): ?string
{
return $this->contactPersonEmail;
}
public function setContactPersonEmail(?string $contactPersonEmail): self
{
$this->contactPersonEmail = $contactPersonEmail;
return $this;
}
public function getContactPersonPhone(): ?string
{
return $this->contactPersonPhone;
}
public function setContactPersonPhone(?string $contactPersonPhone): self
{
$this->contactPersonPhone = $contactPersonPhone;
return $this;
}
public function getProjectManager(): ?User
{
return $this->projectManager;
}
public function setProjectManager(?User $projectManager): self
{
$this->projectManager = $projectManager;
return $this;
}
/**
* @return Collection<int, CashIn>
*/
public function getCashIns(): Collection
{
return $this->cashIns;
}
public function addCashIn(CashIn $cashIn): self
{
if (!$this->cashIns->contains($cashIn)) {
$this->cashIns[] = $cashIn;
$cashIn->setProject($this);
}
return $this;
}
public function removeCashIn(CashIn $cashIn): self
{
if ($this->cashIns->removeElement($cashIn)) {
// set the owning side to null (unless already changed)
if ($cashIn->getProject() === $this) {
$cashIn->setProject(null);
}
}
return $this;
}
/**
* @return Collection<int, CashOut>
*/
public function getCashOuts(): Collection
{
return $this->cashOuts;
}
public function addCashOut(CashOut $cashOut): self
{
if (!$this->cashOuts->contains($cashOut)) {
$this->cashOuts[] = $cashOut;
$cashOut->setProject($this);
}
return $this;
}
public function removeCashOut(CashOut $cashOut): self
{
if ($this->cashOuts->removeElement($cashOut)) {
// set the owning side to null (unless already changed)
if ($cashOut->getProject() === $this) {
$cashOut->setProject(null);
}
}
return $this;
}
}