src/Entity/Plan.php line 11

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\PlanRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassPlanRepository::class)]
  8. class Plan
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column]
  13.     private ?int $id null;
  14.     #[ORM\Column(length255)]
  15.     private ?string $name null;
  16.     #[ORM\Column]
  17.     private ?float $price null;
  18.     #[ORM\Column]
  19.     private ?int $duration null;
  20.     #[ORM\ManyToMany(targetEntityOption::class)]
  21.     private Collection $options;
  22.     #[ORM\Column(options: ['default' => true])]
  23.     private ?bool $isVisible true;
  24.     public function __construct()
  25.     {
  26.         $this->options = 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 getAmount(): ?float
  42.     {
  43.         return $this->price;
  44.     }
  45.     public function getPrice(): ?float
  46.     {
  47.         return $this->price;
  48.     }
  49.     public function setPrice(float $price): self
  50.     {
  51.         $this->price $price;
  52.         return $this;
  53.     }
  54.     public function getDuration(): ?int
  55.     {
  56.         return $this->duration;
  57.     }
  58.     public function setDuration(int $duration): self
  59.     {
  60.         $this->duration $duration;
  61.         return $this;
  62.     }
  63.     /**
  64.      * @return Collection<int, Option>
  65.      */
  66.     public function getOptions(): Collection
  67.     {
  68.         return $this->options;
  69.     }
  70.     public function addOption(Option $option): self
  71.     {
  72.         if (!$this->options->contains($option)) {
  73.             $this->options->add($option);
  74.         }
  75.         return $this;
  76.     }
  77.     public function hasOption(Option $option): bool
  78.     {
  79.         if ($this->options->contains($option)) {
  80.             return true;
  81.         }
  82.         return false;
  83.     }
  84.     public function removeOption(Option $option): self
  85.     {
  86.         $this->options->removeElement($option);
  87.         return $this;
  88.     }
  89.     public function __toString(): string
  90.     {
  91.         return $this->name;
  92.     }
  93.     public function isIsVisible(): ?bool
  94.     {
  95.         return $this->isVisible;
  96.     }
  97.     public function setIsVisible(bool $isVisible): self
  98.     {
  99.         $this->isVisible $isVisible;
  100.         return $this;
  101.     }
  102. }