src/Entity/Program.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ProgramRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\Serializer\Annotation\Ignore;
  8. /**
  9.  * @ORM\Entity(repositoryClass=ProgramRepository::class)
  10.  */
  11. class Program
  12. {
  13.     /**
  14.      * @ORM\Id
  15.      * @ORM\GeneratedValue
  16.      * @ORM\Column(type="integer")
  17.      */
  18.     private $id;
  19.     /**
  20.      * @ORM\Column(type="string", length=255)
  21.      */
  22.     private $name;
  23.     /**
  24.      * @ORM\Column(type="text", nullable=true)
  25.      */
  26.     private $description;
  27.     /**
  28.      * @ORM\ManyToOne(targetEntity=Currency::class)
  29.      * @ORM\JoinColumn(nullable=false)
  30.      */
  31.     private $currency;
  32.     /**
  33.      * @ORM\Column(type="float")
  34.      */
  35.     private $amount;
  36.     /**
  37.      * @ORM\Column(type="date")
  38.      */
  39.     private $start_date;
  40.     /**
  41.      * @ORM\Column(type="date")
  42.      */
  43.     private $end_date;
  44.     /**
  45.      * @ORM\Column(type="text", nullable=true)
  46.      */
  47.     private $objective;
  48.     /**
  49.      * @ORM\Column(type="integer")
  50.      */
  51.     private $status;
  52.     /**
  53.      * @ORM\OneToMany(targetEntity=Project::class, mappedBy="program")
  54.      * @Ignore()
  55.      */
  56.     private $projects;
  57.     /**
  58.      * @ORM\ManyToOne(targetEntity=User::class)
  59.      * @ORM\JoinColumn(nullable=true)
  60.      */
  61.     private $program_manager;
  62.     /**
  63.      * @ORM\ManyToMany(targetEntity=Organization::class)
  64.      */
  65.     private $stakeholders;
  66.     public function __construct()
  67.     {
  68.         $this->projects = new ArrayCollection();
  69.         $this->stakeholders = new ArrayCollection();
  70.     }
  71.     public function getId(): ?int
  72.     {
  73.         return $this->id;
  74.     }
  75.     public function getName(): ?string
  76.     {
  77.         return $this->name;
  78.     }
  79.     public function setName(string $name): self
  80.     {
  81.         $this->name $name;
  82.         return $this;
  83.     }
  84.     public function getDescription(): ?string
  85.     {
  86.         return $this->description;
  87.     }
  88.     public function setDescription(?string $description): self
  89.     {
  90.         $this->description $description;
  91.         return $this;
  92.     }
  93.     public function getCurrency(): ?Currency
  94.     {
  95.         return $this->currency;
  96.     }
  97.     public function setCurrency(?Currency $currency): self
  98.     {
  99.         $this->currency $currency;
  100.         return $this;
  101.     }
  102.     public function getAmount(): ?float
  103.     {
  104.         return $this->amount;
  105.     }
  106.     public function setAmount(float $amount): self
  107.     {
  108.         $this->amount $amount;
  109.         return $this;
  110.     }
  111.     public function getStartDate(): ?\DateTimeInterface
  112.     {
  113.         return $this->start_date;
  114.     }
  115.     public function setStartDate(\DateTimeInterface $start_date): self
  116.     {
  117.         $this->start_date $start_date;
  118.         return $this;
  119.     }
  120.     public function getEndDate(): ?\DateTimeInterface
  121.     {
  122.         return $this->end_date;
  123.     }
  124.     public function setEndDate(\DateTimeInterface $end_date): self
  125.     {
  126.         $this->end_date $end_date;
  127.         return $this;
  128.     }
  129.     public function getObjective(): ?string
  130.     {
  131.         return $this->objective;
  132.     }
  133.     public function setObjective(?string $objective): self
  134.     {
  135.         $this->objective $objective;
  136.         return $this;
  137.     }
  138.     public function getStatus(): ?int
  139.     {
  140.         return $this->status;
  141.     }
  142.     public function setStatus(int $status): self
  143.     {
  144.         $this->status $status;
  145.         return $this;
  146.     }
  147.     public function __toString()
  148.     {
  149.         return $this->name;
  150.     }
  151.     /**
  152.      * @return Collection|Project[]
  153.      */
  154.     public function getProjects(): Collection
  155.     {
  156.         return $this->projects;
  157.     }
  158.     public function addProject(Project $project): self
  159.     {
  160.         if (!$this->projects->contains($project)) {
  161.             $this->projects[] = $project;
  162.             $project->setProgram($this);
  163.         }
  164.         return $this;
  165.     }
  166.     public function removeProject(Project $project): self
  167.     {
  168.         if ($this->projects->removeElement($project)) {
  169.             // set the owning side to null (unless already changed)
  170.             if ($project->getProgram() === $this) {
  171.                 $project->setProgram(null);
  172.             }
  173.         }
  174.         return $this;
  175.     }
  176.     public function getProgramManager(): ?User
  177.     {
  178.         return $this->program_manager;
  179.     }
  180.     public function setProgramManager(?User $program_manager): self
  181.     {
  182.         $this->program_manager $program_manager;
  183.         return $this;
  184.     }
  185.     /**
  186.      * @return Collection|Organization[]
  187.      */
  188.     public function getStakeholders(): Collection
  189.     {
  190.         return $this->stakeholders;
  191.     }
  192.     public function addStakeholder(Organization $stakeholder): self
  193.     {
  194.         if (!$this->stakeholders->contains($stakeholder)) {
  195.             $this->stakeholders[] = $stakeholder;
  196.         }
  197.         return $this;
  198.     }
  199.     public function removeStakeholder(Organization $stakeholder): self
  200.     {
  201.         $this->stakeholders->removeElement($stakeholder);
  202.         return $this;
  203.     }
  204. }