src/Entity/Pack.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\PackRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. #[ORM\Entity(repositoryClassPackRepository::class)]
  9. class Pack
  10. {
  11.     #[ORM\Id]
  12.     #[ORM\GeneratedValue]
  13.     #[ORM\Column]
  14.     private ?int $id null;
  15.     #[ORM\Column(length255nullabletrue)]
  16.     private ?string $libelle null;
  17.     #[ORM\Column(nullabletrue)]
  18.     private ?float $prix null;
  19.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  20.     private ?string $description null;
  21.     #[ORM\Column(length255nullabletrue)]
  22.     private ?string $slug null;
  23.     #[ORM\OneToMany(mappedBy'pack'targetEntityPackItem::class,cascade: ['remove'])]
  24.     private Collection $packItems;
  25.     #[ORM\Column(length255nullabletrue)]
  26.     private ?string $image null;
  27.     #[ORM\OneToMany(mappedBy'pack'targetEntityCommandeFormation::class)]
  28.     private Collection $commandeFormations;
  29.     public function __construct()
  30.     {
  31.         $this->packItems = new ArrayCollection();
  32.         $this->commandeFormations = new ArrayCollection();
  33.     }
  34.     public function getId(): ?int
  35.     {
  36.         return $this->id;
  37.     }
  38.     public function getLibelle(): ?string
  39.     {
  40.         return $this->libelle;
  41.     }
  42.     public function setLibelle(?string $libelle): self
  43.     {
  44.         $this->libelle $libelle;
  45.         return $this;
  46.     }
  47.     public function getPrix(): ?float
  48.     {
  49.         return $this->prix;
  50.     }
  51.     public function setPrix(?float $prix): self
  52.     {
  53.         $this->prix $prix;
  54.         return $this;
  55.     }
  56.     public function getDescription(): ?string
  57.     {
  58.         return $this->description;
  59.     }
  60.     public function setDescription(?string $description): self
  61.     {
  62.         $this->description $description;
  63.         return $this;
  64.     }
  65.     public function getSlug(): ?string
  66.     {
  67.         return $this->slug;
  68.     }
  69.     public function setSlug(?string $slug): self
  70.     {
  71.         $this->slug $slug;
  72.         return $this;
  73.     }
  74.     /**
  75.      * @return Collection<int, PackItem>
  76.      */
  77.     public function getPackItems(): Collection
  78.     {
  79.         return $this->packItems;
  80.     }
  81.     public function addPackItem(PackItem $packItem): self
  82.     {
  83.         if (!$this->packItems->contains($packItem)) {
  84.             $this->packItems->add($packItem);
  85.             $packItem->setPack($this);
  86.         }
  87.         return $this;
  88.     }
  89.     public function removePackItem(PackItem $packItem): self
  90.     {
  91.         if ($this->packItems->removeElement($packItem)) {
  92.             // set the owning side to null (unless already changed)
  93.             if ($packItem->getPack() === $this) {
  94.                 $packItem->setPack(null);
  95.             }
  96.         }
  97.         return $this;
  98.     }
  99.     public function getImage(): ?string
  100.     {
  101.         return $this->image;
  102.     }
  103.     public function setImage(?string $image): self
  104.     {
  105.         $this->image $image;
  106.         return $this;
  107.     }
  108.     /**
  109.      * @return Collection<int, CommandeFormation>
  110.      */
  111.     public function getCommandeFormations(): Collection
  112.     {
  113.         return $this->commandeFormations;
  114.     }
  115.     public function addCommandeFormation(CommandeFormation $commandeFormation): self
  116.     {
  117.         if (!$this->commandeFormations->contains($commandeFormation)) {
  118.             $this->commandeFormations->add($commandeFormation);
  119.             $commandeFormation->setPack($this);
  120.         }
  121.         return $this;
  122.     }
  123.     public function removeCommandeFormation(CommandeFormation $commandeFormation): self
  124.     {
  125.         if ($this->commandeFormations->removeElement($commandeFormation)) {
  126.             // set the owning side to null (unless already changed)
  127.             if ($commandeFormation->getPack() === $this) {
  128.                 $commandeFormation->setPack(null);
  129.             }
  130.         }
  131.         return $this;
  132.     }
  133. }