<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Table(name: 'plan')]
#[ORM\Entity(repositoryClass: 'App\Entity\Repository\PlanRepository')]
class Plan
{
#[ORM\Id]
#[ORM\Column(type: 'integer')]
#[ORM\GeneratedValue(strategy: 'AUTO')]
private $id;
#[ORM\Column(type: 'string', nullable: true)]
private $name;
#[ORM\Column(type: 'text', nullable: true)]
private $description;
#[ORM\Column(type: 'boolean', nullable: true)]
private $is_pro;
#[ORM\Column(type: 'datetime', nullable: true)]
private $date_created;
#[ORM\OneToMany(targetEntity: 'App\Entity\PlanCrop', mappedBy: 'plan')]
private $planCrop;
public function __construct()
{
$this->planCrop = 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 getDateCreated(): ?\DateTimeInterface
{
return $this->date_created;
}
public function setDateCreated(?\DateTimeInterface $date_created): self
{
$this->date_created = $date_created;
return $this;
}
/**
* @return Collection|PlanCrop[]
*/
public function getPlanCrop(): Collection
{
return $this->planCrop;
}
public function addPlanCrop(PlanCrop $planCrop): self
{
if (!$this->planCrop->contains($planCrop)) {
$this->planCrop[] = $planCrop;
$planCrop->setPlan($this);
}
return $this;
}
public function removePlanCrop(PlanCrop $planCrop): self
{
if ($this->planCrop->contains($planCrop)) {
$this->planCrop->removeElement($planCrop);
// set the owning side to null (unless already changed)
if ($planCrop->getPlan() === $this) {
$planCrop->setPlan(null);
}
}
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getIsPro(): ?bool
{
return $this->is_pro;
}
public function setIsPro(?bool $is_pro): self
{
$this->is_pro = $is_pro;
return $this;
}
}