<?php
namespace App\Entity;
use App\Repository\ProgramRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Ignore;
/**
* @ORM\Entity(repositoryClass=ProgramRepository::class)
*/
class Program
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $name;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $description;
/**
* @ORM\ManyToOne(targetEntity=Currency::class)
* @ORM\JoinColumn(nullable=false)
*/
private $currency;
/**
* @ORM\Column(type="float")
*/
private $amount;
/**
* @ORM\Column(type="date")
*/
private $start_date;
/**
* @ORM\Column(type="date")
*/
private $end_date;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $objective;
/**
* @ORM\Column(type="integer")
*/
private $status;
/**
* @ORM\OneToMany(targetEntity=Project::class, mappedBy="program")
* @Ignore()
*/
private $projects;
/**
* @ORM\ManyToOne(targetEntity=User::class)
* @ORM\JoinColumn(nullable=true)
*/
private $program_manager;
/**
* @ORM\ManyToMany(targetEntity=Organization::class)
*/
private $stakeholders;
public function __construct()
{
$this->projects = new ArrayCollection();
$this->stakeholders = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getCurrency(): ?Currency
{
return $this->currency;
}
public function setCurrency(?Currency $currency): self
{
$this->currency = $currency;
return $this;
}
public function getAmount(): ?float
{
return $this->amount;
}
public function setAmount(float $amount): self
{
$this->amount = $amount;
return $this;
}
public function getStartDate(): ?\DateTimeInterface
{
return $this->start_date;
}
public function setStartDate(\DateTimeInterface $start_date): self
{
$this->start_date = $start_date;
return $this;
}
public function getEndDate(): ?\DateTimeInterface
{
return $this->end_date;
}
public function setEndDate(\DateTimeInterface $end_date): self
{
$this->end_date = $end_date;
return $this;
}
public function getObjective(): ?string
{
return $this->objective;
}
public function setObjective(?string $objective): self
{
$this->objective = $objective;
return $this;
}
public function getStatus(): ?int
{
return $this->status;
}
public function setStatus(int $status): self
{
$this->status = $status;
return $this;
}
public function __toString()
{
return $this->name;
}
/**
* @return Collection|Project[]
*/
public function getProjects(): Collection
{
return $this->projects;
}
public function addProject(Project $project): self
{
if (!$this->projects->contains($project)) {
$this->projects[] = $project;
$project->setProgram($this);
}
return $this;
}
public function removeProject(Project $project): self
{
if ($this->projects->removeElement($project)) {
// set the owning side to null (unless already changed)
if ($project->getProgram() === $this) {
$project->setProgram(null);
}
}
return $this;
}
public function getProgramManager(): ?User
{
return $this->program_manager;
}
public function setProgramManager(?User $program_manager): self
{
$this->program_manager = $program_manager;
return $this;
}
/**
* @return Collection|Organization[]
*/
public function getStakeholders(): Collection
{
return $this->stakeholders;
}
public function addStakeholder(Organization $stakeholder): self
{
if (!$this->stakeholders->contains($stakeholder)) {
$this->stakeholders[] = $stakeholder;
}
return $this;
}
public function removeStakeholder(Organization $stakeholder): self
{
$this->stakeholders->removeElement($stakeholder);
return $this;
}
}