src/Flexy/ShopBundle/Entity/Customer/Pack.php line 13

  1. <?php
  2. namespace App\Flexy\ShopBundle\Entity\Customer;
  3. use ApiPlatform\Core\Annotation\ApiResource;
  4. use App\Repository\Flexy\ShopBundle\Entity\Customer\PackRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. #[ApiResource]
  9. #[ORM\Entity(repositoryClassPackRepository::class)]
  10. class Pack implements \Stringable
  11. {
  12.     #[ORM\Id]
  13.     #[ORM\GeneratedValue]
  14.     #[ORM\Column(type'integer')]
  15.     private $id;
  16.     #[ORM\Column(type'string'length255)]
  17.     private ?string $title null;
  18.     #[ORM\Column(type'text')]
  19.     private ?string $description null;
  20.     #[ORM\Column(type'integer')]
  21.     private ?int $nbrProducts null;
  22.     #[ORM\OneToMany(targetEntityPackEngagement::class, mappedBy'pack')]
  23.     private \Doctrine\Common\Collections\Collection|array $packEngagements;
  24.     #[ORM\Column(type'float')]
  25.     private ?float $price null;
  26.     #[ORM\Column(type'string'length255nullabletrue)]
  27.     private ?string $image null;
  28.     public function __toString(): string
  29.     {
  30.         return (string) $this->title;
  31.     }
  32.     public function __construct()
  33.     {
  34.         $this->packEngagements = new ArrayCollection();
  35.     }
  36.     public function getId(): ?int
  37.     {
  38.         return $this->id;
  39.     }
  40.     public function getTitle(): ?string
  41.     {
  42.         return $this->title;
  43.     }
  44.     public function setTitle(string $title): self
  45.     {
  46.         $this->title $title;
  47.         return $this;
  48.     }
  49.     public function getDescription(): ?string
  50.     {
  51.         return $this->description;
  52.     }
  53.     public function setDescription(string $description): self
  54.     {
  55.         $this->description $description;
  56.         return $this;
  57.     }
  58.     public function getNbrProducts(): ?int
  59.     {
  60.         return $this->nbrProducts;
  61.     }
  62.     public function setNbrProducts(int $nbrProducts): self
  63.     {
  64.         $this->nbrProducts $nbrProducts;
  65.         return $this;
  66.     }
  67.     /**
  68.      * @return Collection<int, PackEngagement>
  69.      */
  70.     public function getPackEngagements(): Collection
  71.     {
  72.         return $this->packEngagements;
  73.     }
  74.     public function addPackEngagement(PackEngagement $packEngagement): self
  75.     {
  76.         if (!$this->packEngagements->contains($packEngagement)) {
  77.             $this->packEngagements[] = $packEngagement;
  78.             $packEngagement->setPack($this);
  79.         }
  80.         return $this;
  81.     }
  82.     public function removePackEngagement(PackEngagement $packEngagement): self
  83.     {
  84.         if ($this->packEngagements->removeElement($packEngagement)) {
  85.             // set the owning side to null (unless already changed)
  86.             if ($packEngagement->getPack() === $this) {
  87.                 $packEngagement->setPack(null);
  88.             }
  89.         }
  90.         return $this;
  91.     }
  92.     public function getPrice(): ?float
  93.     {
  94.         return $this->price;
  95.     }
  96.     public function setPrice(float $price): self
  97.     {
  98.         $this->price $price;
  99.         return $this;
  100.     }
  101.     public function getImage(): ?string
  102.     {
  103.         return $this->image;
  104.     }
  105.     public function setImage(?string $image): self
  106.     {
  107.         $this->image $image;
  108.         return $this;
  109.     }
  110. }