src/Entity/Plan.php line 9

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. #[ORM\Table(name'plan')]
  7. #[ORM\Entity(repositoryClass'App\Entity\Repository\PlanRepository')]
  8. class Plan
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\Column(type'integer')]
  12.     #[ORM\GeneratedValue(strategy'AUTO')]
  13.     private $id;
  14.     #[ORM\Column(type'string'nullabletrue)]
  15.     private $name;
  16.     #[ORM\Column(type'text'nullabletrue)]
  17.     private $description;
  18.     #[ORM\Column(type'boolean'nullabletrue)]
  19.     private $is_pro;
  20.     #[ORM\Column(type'datetime'nullabletrue)]
  21.     private $date_created;
  22.     #[ORM\OneToMany(targetEntity'App\Entity\PlanCrop'mappedBy'plan')]
  23.     private $planCrop;
  24.     public function __construct()
  25.     {
  26.         $this->planCrop = new ArrayCollection();
  27.     }
  28.     public function getId(): ?int
  29.     {
  30.         return $this->id;
  31.     }
  32.     public function getName(): ?string
  33.     {
  34.         return $this->name;
  35.     }
  36.     public function setName(?string $name): self
  37.     {
  38.         $this->name $name;
  39.         return $this;
  40.     }
  41.     public function getDateCreated(): ?\DateTimeInterface
  42.     {
  43.         return $this->date_created;
  44.     }
  45.     public function setDateCreated(?\DateTimeInterface $date_created): self
  46.     {
  47.         $this->date_created $date_created;
  48.         return $this;
  49.     }
  50.     /**
  51.      * @return Collection|PlanCrop[]
  52.      */
  53.     public function getPlanCrop(): Collection
  54.     {
  55.         return $this->planCrop;
  56.     }
  57.     public function addPlanCrop(PlanCrop $planCrop): self
  58.     {
  59.         if (!$this->planCrop->contains($planCrop)) {
  60.             $this->planCrop[] = $planCrop;
  61.             $planCrop->setPlan($this);
  62.         }
  63.         return $this;
  64.     }
  65.     public function removePlanCrop(PlanCrop $planCrop): self
  66.     {
  67.         if ($this->planCrop->contains($planCrop)) {
  68.             $this->planCrop->removeElement($planCrop);
  69.             // set the owning side to null (unless already changed)
  70.             if ($planCrop->getPlan() === $this) {
  71.                 $planCrop->setPlan(null);
  72.             }
  73.         }
  74.         return $this;
  75.     }
  76.     public function getDescription(): ?string
  77.     {
  78.         return $this->description;
  79.     }
  80.     public function setDescription(?string $description): self
  81.     {
  82.         $this->description $description;
  83.         return $this;
  84.     }
  85.     public function getIsPro(): ?bool
  86.     {
  87.         return $this->is_pro;
  88.     }
  89.     public function setIsPro(?bool $is_pro): self
  90.     {
  91.         $this->is_pro $is_pro;
  92.         return $this;
  93.     }
  94. }