src/Entity/Project.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Base\AbstractTimestampableEntity;
  4. use App\Repository\ProjectRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. /**
  9.  * @ORM\Entity(repositoryClass=ProjectRepository::class)
  10.  * @ORM\HasLifecycleCallbacks
  11.  */
  12. class Project extends AbstractTimestampableEntity
  13. {
  14.     /**
  15.      * @ORM\Column(type="string", length=255)
  16.      */
  17.     private $name;
  18.     /**
  19.      * @ORM\Column(type="float", nullable=true)
  20.      */
  21.     private $price;
  22.     /**
  23.      * @ORM\Column(type="integer", nullable=false, options={"default"=0})
  24.      */
  25.     private $scheduledHours=0;
  26.     /**
  27.      * @ORM\Column(type="integer", nullable=true)
  28.      */
  29.     private $workedHours;
  30.     /**
  31.      * @ORM\Column(type="string", length=100, nullable=true)
  32.      */
  33.     private $url;
  34.     /**
  35.      * @ORM\Column(type="datetime", nullable=true)
  36.      */
  37.     private $endDate;
  38.     /**
  39.      * @ORM\ManyToOne(targetEntity=Company::class, inversedBy="projects")
  40.      * @ORM\JoinColumn(nullable=false)
  41.      */
  42.     private $company;
  43.     /**
  44.      * @ORM\Column(type="text", nullable=true)
  45.      */
  46.     private $description;
  47.     /**
  48.      * @ORM\ManyToOne(targetEntity=ProjectType::class)
  49.      * @ORM\JoinColumn(nullable=false)
  50.      */
  51.     private $projectType;
  52.     /**
  53.      * @ORM\Column(type="text", nullable=true)
  54.      */
  55.     private $securityData;
  56.     /**
  57.      * @ORM\ManyToOne(targetEntity=ProjectStatus::class)
  58.      * @ORM\JoinColumn(nullable=false)
  59.      */
  60.     private $status;
  61.     /**
  62.      * @ORM\Column(type="datetime")
  63.      */
  64.     private $deadline;
  65.     /**
  66.      * @ORM\OneToMany(targetEntity=Offer::class, mappedBy="project")
  67.      */
  68.     private $offers;
  69.     /**
  70.      * @ORM\OneToMany(targetEntity=Task::class, mappedBy="project")
  71.      */
  72.     private $tasks;
  73.     /**
  74.      * @ORM\ManyToOne(targetEntity=Currency::class)
  75.      * @ORM\JoinColumn(nullable=false)
  76.      */
  77.     private $currency;
  78.     /**
  79.      * @ORM\Column(type="decimal")
  80.      */
  81.     private float $hourlyRate;
  82.     /**
  83.      * @ORM\OneToMany(targetEntity=Contract::class, mappedBy="project")
  84.      */
  85.     private $contracts;
  86.     /**
  87.      * @ORM\Column(type="string", length=255, nullable=true)
  88.      */
  89.     private $contactPersonName;
  90.     /**
  91.      * @ORM\Column(type="string", length=255, nullable=true)
  92.      */
  93.     private $contactPersonEmail;
  94.     /**
  95.      * @ORM\Column(type="string", length=255, nullable=true)
  96.      */
  97.     private $contactPersonPhone;
  98.     /**
  99.      * @ORM\ManyToOne(targetEntity=User::class)
  100.      */
  101.     private $projectManager;
  102.     /**
  103.      * @ORM\OneToMany(targetEntity=CashIn::class, mappedBy="project")
  104.      */
  105.     private $cashIns;
  106.     /**
  107.      * @ORM\OneToMany(targetEntity=CashOut::class, mappedBy="project")
  108.      */
  109.     private $cashOuts;
  110.     public function __construct()
  111.     {
  112.         $this->offers = new ArrayCollection();
  113.         $this->tasks = new ArrayCollection();
  114.         $this->contracts = new ArrayCollection();
  115.         $this->cashIns = new ArrayCollection();
  116.         $this->cashOuts = new ArrayCollection();
  117.     }
  118.     public function getName(): ?string
  119.     {
  120.         return $this->name;
  121.     }
  122.     public function setName(string $name): self
  123.     {
  124.         $this->name $name;
  125.         return $this;
  126.     }
  127.     public function getPrice(): ?float
  128.     {
  129.         return $this->price;
  130.     }
  131.     public function setPrice(?float $price): self
  132.     {
  133.         $this->price $price;
  134.         return $this;
  135.     }
  136.     public function getScheduledHours(): int
  137.     {
  138.         return $this->scheduledHours;
  139.     }
  140.     public function setScheduledHours(int $scheduledHours): void
  141.     {
  142.         $this->scheduledHours $scheduledHours;
  143.     }
  144.     public function getWorkedHours(): ?int
  145.     {
  146.         return $this->workedHours;
  147.     }
  148.     public function setWorkedHours(int $workedHours): self
  149.     {
  150.         $this->workedHours $workedHours;
  151.         return $this;
  152.     }
  153.     public function getUrl(): ?string
  154.     {
  155.         return $this->url;
  156.     }
  157.     public function setUrl(?string $url): self
  158.     {
  159.         $this->url $url;
  160.         return $this;
  161.     }
  162.     public function getEndDate(): ?\DateTimeInterface
  163.     {
  164.         return $this->endDate;
  165.     }
  166.     public function setEndDate(?\DateTimeInterface $endDate): self
  167.     {
  168.         $this->endDate $endDate;
  169.         return $this;
  170.     }
  171.     public function getCompany(): ?Company
  172.     {
  173.         return $this->company;
  174.     }
  175.     public function setCompany(?Company $company): self
  176.     {
  177.         $this->company $company;
  178.         return $this;
  179.     }
  180.     public function getDescription(): ?string
  181.     {
  182.         return $this->description;
  183.     }
  184.     public function setDescription(?string $description): self
  185.     {
  186.         $this->description $description;
  187.         return $this;
  188.     }
  189.     public function getType(): ?ProjectType
  190.     {
  191.         return $this->projectType;
  192.     }
  193.     public function setType(?ProjectType $projectType): self
  194.     {
  195.         $this->projectType $projectType;
  196.         return $this;
  197.     }
  198.     public function getProjectType()
  199.     {
  200.         return $this->projectType;
  201.     }
  202.     public function setProjectType($projectType): void
  203.     {
  204.         $this->projectType $projectType;
  205.     }
  206.     public function getSecurityData()
  207.     {
  208.         return $this->securityData;
  209.     }
  210.     public function setSecurityData($securityData): void
  211.     {
  212.         $this->securityData $securityData;
  213.     }
  214.     public function getStatus(): ?ProjectStatus
  215.     {
  216.         return $this->status;
  217.     }
  218.     public function setStatus(?ProjectStatus $status): self
  219.     {
  220.         $this->status $status;
  221.         return $this;
  222.     }
  223.     public function getDeadline(): ?\DateTimeInterface
  224.     {
  225.         return $this->deadline;
  226.     }
  227.     public function setDeadline(\DateTimeInterface $deadline): self
  228.     {
  229.         $this->deadline $deadline;
  230.         return $this;
  231.     }
  232.     /**
  233.      * @return Collection<int, Offer>
  234.      */
  235.     public function getOffers(): Collection
  236.     {
  237.         return $this->offers;
  238.     }
  239.     public function addOffer(Offer $offer): self
  240.     {
  241.         if (!$this->offers->contains($offer)) {
  242.             $this->offers[] = $offer;
  243.             $offer->setProject($this);
  244.         }
  245.         return $this;
  246.     }
  247.     public function removeOffer(Offer $offer): self
  248.     {
  249.         if ($this->offers->removeElement($offer)) {
  250.             // set the owning side to null (unless already changed)
  251.             if ($offer->getProject() === $this) {
  252.                 $offer->setProject(null);
  253.             }
  254.         }
  255.         return $this;
  256.     }
  257.     /**
  258.      * @return Collection<int, Task>
  259.      */
  260.     public function getTasks(): Collection
  261.     {
  262.         return $this->tasks;
  263.     }
  264.     public function addTask(Task $task): self
  265.     {
  266.         if (!$this->tasks->contains($task)) {
  267.             $this->tasks[] = $task;
  268.             $task->setProject($this);
  269.         }
  270.         return $this;
  271.     }
  272.     public function removeTask(Task $task): self
  273.     {
  274.         if ($this->tasks->removeElement($task)) {
  275.             // set the owning side to null (unless already changed)
  276.             if ($task->getProject() === $this) {
  277.                 $task->setProject(null);
  278.             }
  279.         }
  280.         return $this;
  281.     }
  282.     public function getCurrency()
  283.     {
  284.         return $this->currency;
  285.     }
  286.     public function setCurrency($currency): void
  287.     {
  288.         $this->currency $currency;
  289.     }
  290.     public function getHourlyRate(): float
  291.     {
  292.         return $this->hourlyRate;
  293.     }
  294.     public function setHourlyRate(float $hourlyRate): void
  295.     {
  296.         $this->hourlyRate $hourlyRate;
  297.     }
  298.     /**
  299.      * @return Collection<int, Contract>
  300.      */
  301.     public function getContracts(): Collection
  302.     {
  303.         return $this->contracts;
  304.     }
  305.     public function addContract(Contract $contract): self
  306.     {
  307.         if (!$this->contracts->contains($contract)) {
  308.             $this->contracts[] = $contract;
  309.             $contract->setProject($this);
  310.         }
  311.         return $this;
  312.     }
  313.     public function removeContract(Contract $contract): self
  314.     {
  315.         if ($this->contracts->removeElement($contract)) {
  316.             // set the owning side to null (unless already changed)
  317.             if ($contract->getProject() === $this) {
  318.                 $contract->setProject(null);
  319.             }
  320.         }
  321.         return $this;
  322.     }
  323.     public function getContactPersonName(): ?string
  324.     {
  325.         return $this->contactPersonName;
  326.     }
  327.     public function setContactPersonName(?string $contactPersonName): self
  328.     {
  329.         $this->contactPersonName $contactPersonName;
  330.         return $this;
  331.     }
  332.     public function getContactPersonEmail(): ?string
  333.     {
  334.         return $this->contactPersonEmail;
  335.     }
  336.     public function setContactPersonEmail(?string $contactPersonEmail): self
  337.     {
  338.         $this->contactPersonEmail $contactPersonEmail;
  339.         return $this;
  340.     }
  341.     public function getContactPersonPhone(): ?string
  342.     {
  343.         return $this->contactPersonPhone;
  344.     }
  345.     public function setContactPersonPhone(?string $contactPersonPhone): self
  346.     {
  347.         $this->contactPersonPhone $contactPersonPhone;
  348.         return $this;
  349.     }
  350.     public function getProjectManager(): ?User
  351.     {
  352.         return $this->projectManager;
  353.     }
  354.     public function setProjectManager(?User $projectManager): self
  355.     {
  356.         $this->projectManager $projectManager;
  357.         return $this;
  358.     }
  359.     /**
  360.      * @return Collection<int, CashIn>
  361.      */
  362.     public function getCashIns(): Collection
  363.     {
  364.         return $this->cashIns;
  365.     }
  366.     public function addCashIn(CashIn $cashIn): self
  367.     {
  368.         if (!$this->cashIns->contains($cashIn)) {
  369.             $this->cashIns[] = $cashIn;
  370.             $cashIn->setProject($this);
  371.         }
  372.         return $this;
  373.     }
  374.     public function removeCashIn(CashIn $cashIn): self
  375.     {
  376.         if ($this->cashIns->removeElement($cashIn)) {
  377.             // set the owning side to null (unless already changed)
  378.             if ($cashIn->getProject() === $this) {
  379.                 $cashIn->setProject(null);
  380.             }
  381.         }
  382.         return $this;
  383.     }
  384.     /**
  385.      * @return Collection<int, CashOut>
  386.      */
  387.     public function getCashOuts(): Collection
  388.     {
  389.         return $this->cashOuts;
  390.     }
  391.     public function addCashOut(CashOut $cashOut): self
  392.     {
  393.         if (!$this->cashOuts->contains($cashOut)) {
  394.             $this->cashOuts[] = $cashOut;
  395.             $cashOut->setProject($this);
  396.         }
  397.         return $this;
  398.     }
  399.     public function removeCashOut(CashOut $cashOut): self
  400.     {
  401.         if ($this->cashOuts->removeElement($cashOut)) {
  402.             // set the owning side to null (unless already changed)
  403.             if ($cashOut->getProject() === $this) {
  404.                 $cashOut->setProject(null);
  405.             }
  406.         }
  407.         return $this;
  408.     }
  409. }