src/Flexy/ShopBundle/Entity/Product/Product.php line 42

  1. <?php
  2. namespace App\Flexy\ShopBundle\Entity\Product;
  3. use ApiPlatform\Core\Annotation\ApiResource;
  4. use App\Flexy\ShopBundle\Entity\Brand;
  5. use App\Flexy\ShopBundle\Entity\Order\OrderItem;
  6. use App\Flexy\ShopBundle\Entity\Product\CategoryProduct;
  7. use App\Flexy\ShopBundle\Entity\Promotion\Promotion;
  8. use App\Flexy\ShopBundle\Entity\Store\Store;
  9. use App\Flexy\ShopBundle\Entity\Vendor\Vendor;
  10. use App\Flexy\ShopBundle\Repository\Product\ProductRepository;
  11. use Doctrine\Common\Collections\ArrayCollection;
  12. use Doctrine\Common\Collections\Collection;
  13. use Doctrine\ORM\Mapping as ORM;
  14. use Doctrine\ORM\Mapping\Table;
  15. use Doctrine\ORM\Mapping\Entity;
  16. use Doctrine\ORM\Mapping\InheritanceType;
  17. use Gedmo\Mapping\Annotation as Gedmo;
  18. use Symfony\Component\Filesystem\Filesystem;
  19. use Symfony\Component\Serializer\Annotation\Groups;
  20. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  21. use ApiPlatform\Core\Annotation\ApiFilter;
  22. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter;
  23. #[ApiResource(
  24.     normalizationContext: ['groups' => ['read']],
  25.     denormalizationContext: ['groups' => ['write']],
  26.     
  27.     )]
  28. #[ApiFilter(SearchFilter::class, properties: ['name' => 'partial','categoriesProduct' => 'partial','productType'=>'exact'])]
  29. #[Table(name'product')]
  30. #[ORM\Entity(repositoryClassProductRepository::class)]
  31. #[InheritanceType('JOINED')]
  32. #[Gedmo\SoftDeleteable(fieldName'deletedAt'timeAwarefalsehardDeletetrue)]
  33. #[Gedmo\Tree(type'nested')]
  34. #[UniqueEntity(
  35.     fields: ['name'],
  36.     message'Ce produit avec ce nom est déja existe, utilisez un autre nom pour ce produit.',
  37. )]
  38. class Product implements \Stringable
  39. {
  40.     #[Groups(['read''readDeep'])]
  41.     #[ORM\Id]
  42.     #[ORM\GeneratedValue]
  43.     #[ORM\Column(type'integer')]
  44.     private $id;
  45.     #[Groups(['read''readDeep'])]
  46.     #[ORM\Column(type'string'length255)]
  47.     private ?string $name null;
  48.     #[Groups(['read''readDeep'])]
  49.     #[ORM\Column(type'string'length255,nullable:true)]
  50.     private string|null $image "" ;
  51.     #[Groups(['read''readDeep'])]
  52.     #[ORM\Column(type'float',nullable:true)]
  53.     private ?float $price 0;
  54.     #[Groups(['read''readDeep'])]
  55.     #[ORM\Column(type'text'nullabletrue)]
  56.     private ?string $description null;
  57.     #[ORM\ManyToMany(targetEntityCategoryProduct::class, inversedBy'products'cascade: ['persist'])]
  58.     private  $categoriesProduct;
  59.     #[ORM\OneToMany(targetEntityAttributValue::class, mappedBy'product'cascade: ['persist'])]
  60.     #[Groups(['read''readDeep'])]
  61.     private  $attributValues;
  62.     #[Groups(['read''readDeep'])]
  63.     #[ORM\Column(type'float'nullabletrue)]
  64.     private ?float $oldPrice null;
  65.     #[Groups(['read''readDeep'])]
  66.     #[ORM\Column(type'integer'nullabletrue)]
  67.     private ?int $quantity null;
  68.     #[Groups(['read''readDeep'])]
  69.     #[ORM\Column(type'string'length255nullabletrue)]
  70.     private ?string $productType "simple";
  71.     #[ORM\Column(type'string'length255nullabletrue)]
  72.     private ?string $metaTitle null;
  73.     #[ORM\Column(type'string'length255nullabletrue)]
  74.     private ?string $metaDescription null;
  75.     #[ORM\Column(type'simple_array'nullabletrue)]
  76.     private ?array $metaKeywords = [];
  77.     #[ORM\OneToMany(targetEntityImageProduct::class, mappedBy'product'cascade: ['persist'])]
  78.     private  $images;
  79.     /**
  80.      * @Gedmo\Slug(fields={"name"})
  81.      */
  82.     #[ORM\Column(type'string'length255)]
  83.     private ?string $slug null;
  84.     #[ORM\Column(type'datetime_immutable'nullabletrue)]
  85.     private ?\DateTimeImmutable $createdAt null;
  86.     #[ORM\OneToMany(targetEntityProductVariant::class, mappedBy'product'cascade: ['persist'])]
  87.     private  $productVariants;
  88.     #[ORM\Column(type'boolean'nullabletrue)]
  89.     private ?bool $isPriceReducedPerPercent null;
  90.     #[ORM\Column(type'float'nullabletrue)]
  91.     private ?float $percentReduction null;
  92.     #[ORM\Column(type'string'length255nullabletrue)]
  93.     private ?string $skuCode null;
  94.     #[ORM\OneToMany(targetEntityOrderItem::class, mappedBy'product'cascade: ['persist'])]
  95.     private  $orderItems;
  96.     #[ORM\ManyToOne(targetEntityPromotion::class, inversedBy'products')]
  97.     private ?\App\Flexy\ShopBundle\Entity\Promotion\Promotion $promotion null;
  98.     #[ORM\ManyToOne(targetEntityVendor::class, inversedBy'products')]
  99.     private ?\App\Flexy\ShopBundle\Entity\Vendor\Vendor $vendor null;
  100.     #[ORM\ManyToOne(targetEntityBrand::class, inversedBy'products'cascade: ['persist'])]
  101.     private ?\App\Flexy\ShopBundle\Entity\Brand $brand null;
  102.     #[ORM\Column(type'text'nullabletrue)]
  103.     private ?string $shortDescription null;
  104.     #[ORM\Column(type'boolean'nullabletrue)]
  105.     private ?bool $isPublished true;
  106.     #[ORM\OneToMany(targetEntityComment::class, mappedBy'product')]
  107.     private  $comments;
  108.     #[ORM\Column(type'string'length255nullabletrue)]
  109.     private ?string $skuCodeShop null;
  110.     #[ORM\Column(type'datetime_immutable'nullabletrue)]
  111.     private ?\DateTimeImmutable $endAt null;
  112.     #[ORM\ManyToOne(targetEntityCategoryProduct::class, inversedBy'productsChildrens')]
  113.     private ?\App\Flexy\ShopBundle\Entity\Product\CategoryProduct $parentCategory null;
  114.     #[ORM\ManyToOne(targetEntityProduct::class)]
  115.     private ?\App\Flexy\ShopBundle\Entity\Product\Product $clonedProduct null;
  116.     #[ORM\Column(type'string'length255nullabletrue)]
  117.     private ?string $typeReduction null;
  118.     #[ORM\Column(type'string'length255nullabletrue)]
  119.     private ?string $valueReduction null;
  120.     #[ORM\OneToMany(mappedBy'product'targetEntityProductSubscription::class, orphanRemovaltrue)]
  121.     private Collection $productSubscriptions;
  122.     #[ORM\Column(nullabletrue)]
  123.     #[Groups(['read''readDeep'])]
  124.     private ?float $subscriptionMonthlyPrice null;
  125.     #[ORM\Column(nullabletrue)]
  126.     #[Groups(['read''readDeep'])]
  127.     private ?float $subscriptionYearlyPrice null;
  128.     #[ORM\ManyToOne(inversedBy'products')]
  129.     private ?Store $store null;
  130.     #[ORM\Column(nullabletrue)]
  131.     private ?\DateTimeImmutable $deletedAt null;
  132.     #[ORM\OneToMany(mappedBy'parentProduct'targetEntityProductPack::class, orphanRemovaltrue,cascade:["persist","remove"])]
  133.     private Collection $childrenProductsPack;
  134.     #[ORM\Column(nullabletrue)]
  135.     #[Groups(['read''readDeep'])]
  136.     private ?bool $labelPriceFrom null;
  137.     #[ORM\Column(length255nullabletrue)]
  138.     private ?string $capacity null;
  139.     
  140.     public function __construct()
  141.     {
  142.         $this->categoriesProduct = new ArrayCollection();
  143.         $this->attributValues = new ArrayCollection();
  144.         $this->createdAt = new \DateTimeImmutable();
  145.         $this->images = new ArrayCollection();
  146.         $this->productVariants = new ArrayCollection();
  147.         $this->orderItems = new ArrayCollection();
  148.         $this->comments = new ArrayCollection();
  149.         $this->productSubscriptions = new ArrayCollection();
  150.         $this->childrenProductsPack = new ArrayCollection();
  151.        
  152.   
  153.     }
  154.     public function __toString(): string
  155.     {
  156.         return (string) $this->name;
  157.     }
  158.     public function getId(): ?int
  159.     {
  160.         return $this->id;
  161.     }
  162.     #[Groups(['read''readDeep'])]
  163.     public function getCategoriesByName(){
  164.         $categories = [];
  165.         foreach($this->categoriesProduct as $singleCategory){
  166.             $categories[]=$singleCategory->getName();
  167.         }
  168.         return $categories;
  169.     }
  170.     #[Groups(['read'])]
  171.     public function getParentCategoryByName(){
  172.         $name null;
  173.         if($this->parentCategory){
  174.             $name $this->parentCategory->getName();
  175.         }
  176.         return $name;
  177.     }
  178.     public function setId($id=null): self
  179.     {
  180.         $this->id $id;
  181.         return $this;
  182.     }
  183.     public function getName(): ?string
  184.     {
  185.         return $this->name;
  186.     }
  187.     public function setName(string $name): self
  188.     {
  189.         $this->name $name;
  190.         return $this;
  191.     }
  192.     public function getPrice(): ?float
  193.     {
  194.         return $this->price;
  195.     }
  196.     #[Groups(['read''readDeep'])]
  197.     public function getReduction(): ?float
  198.     {
  199.         $reduction 0;
  200.         if($this->typeReduction and $this->valueReduction){
  201.             if($this->typeReduction == "percent"){
  202.                 $reduction = ((float)$this->price  100) * $this->valueReduction;
  203.             }else{
  204.                 $reduction =  $this->valueReduction ;
  205.             }
  206.         }
  207.         return $reduction;
  208.     }
  209.     
  210.     public function setPrice(float $price): self
  211.     {
  212.         $this->price $price;
  213.         return $this;
  214.     }
  215.     public function getDescription(): ?string
  216.     {
  217.         return $this->description;
  218.     }
  219.     public function setDescription(?string $description): self
  220.     {
  221.         $this->description $description;
  222.         return $this;
  223.     }
  224.     /**
  225.      * Get the value of image
  226.      */ 
  227.     public function getImage()
  228.     {
  229.         return $this->image;
  230.     }
  231.     /**
  232.      * Set the value of image
  233.      */
  234.     public function setImage($image)
  235.     {
  236.         $this->image = (string)$image;
  237.         return $this;
  238.     }
  239.     /**
  240.      * @return Collection|CategoryProduct[]
  241.      */
  242.     public function getCategoriesProduct(): Collection
  243.     {
  244.         return $this->categoriesProduct;
  245.     }
  246.     public function addCategoryProduct(CategoryProduct $categoryProduct): self
  247.     {
  248.         if (!$this->categoriesProduct->contains($categoryProduct)) {
  249.             $this->categoriesProduct[] = $categoryProduct;
  250.             $categoryProduct->addProduct($this);
  251.         }
  252.         return $this;
  253.     }
  254.     public function removeCategoryProduct(CategoryProduct $categoryProduct): self
  255.     {
  256.         if ($this->categoriesProduct->removeElement($categoryProduct)) {
  257.             $categoryProduct->removeProduct($this);
  258.         }
  259.         return $this;
  260.     }
  261.     /**
  262.      * @return Collection|AttributValue[]
  263.      */
  264.     public function getAttributValues(): Collection
  265.     {
  266.         return $this->attributValues;
  267.     }
  268.     public function addAttributValue(AttributValue $attributValue): self
  269.     {
  270.         if (!$this->attributValues->contains($attributValue)) {
  271.             $this->attributValues[] = $attributValue;
  272.             $attributValue->setProduct($this);
  273.         }
  274.         return $this;
  275.     }
  276.     public function removeAttributValue(AttributValue $attributValue): self
  277.     {
  278.         if ($this->attributValues->removeElement($attributValue)) {
  279.             // set the owning side to null (unless already changed)
  280.             if ($attributValue->getProduct() === $this) {
  281.                 $attributValue->setProduct(null);
  282.             }
  283.         }
  284.         return $this;
  285.     }
  286.     public function getOldPrice(): ?float
  287.     {
  288.         return $this->oldPrice;
  289.     }
  290.     public function setOldPrice(?float $oldPrice): self
  291.     {
  292.         $this->oldPrice $oldPrice;
  293.         return $this;
  294.     }
  295.     public function getQuantity(): ?int
  296.     {
  297.         return $this->quantity;
  298.     }
  299.     public function setQuantity(?int $quantity): self
  300.     {
  301.         $this->quantity $quantity;
  302.         return $this;
  303.     }
  304.     public function getProductType(): ?string
  305.     {
  306.         return $this->productType;
  307.     }
  308.     public function setProductType(?string $productType): self
  309.     {
  310.         $this->productType $productType;
  311.         return $this;
  312.     }
  313.     public function getMetaTitle(): ?string
  314.     {
  315.         return $this->metaTitle;
  316.     }
  317.     public function setMetaTitle(?string $metaTitle): self
  318.     {
  319.         $this->metaTitle $metaTitle;
  320.         return $this;
  321.     }
  322.     public function getMetaDescription(): ?string
  323.     {
  324.         return $this->metaDescription;
  325.     }
  326.     public function setMetaDescription(?string $metaDescription): self
  327.     {
  328.         $this->metaDescription $metaDescription;
  329.         return $this;
  330.     }
  331.     public function getMetaKeywords(): ?array
  332.     {
  333.         return $this->metaKeywords;
  334.     }
  335.     public function setMetaKeywords(?array $metaKeywords): self
  336.     {
  337.         $this->metaKeywords $metaKeywords;
  338.         return $this;
  339.     }
  340.     /**
  341.      * @return Collection|ImageProduct[]
  342.      */
  343.     public function getImages(): Collection
  344.     {
  345.         return $this->images;
  346.     }
  347.     public function addImage(ImageProduct $image): self
  348.     {
  349.         if (!$this->images->contains($image)) {
  350.             $this->images[] = $image;
  351.             $image->setProduct($this);
  352.         }
  353.         return $this;
  354.     }
  355.     public function removeImage(ImageProduct $image): self
  356.     {
  357.         if ($this->images->removeElement($image)) {
  358.             // set the owning side to null (unless already changed)
  359.             if ($image->getProduct() === $this) {
  360.                 $image->setProduct(null);
  361.             }
  362.         }
  363.         return $this;
  364.     }
  365.     public function getSlug(): ?string
  366.     {
  367.         return $this->slug;
  368.     }
  369.     public function setSlug(string $slug): self
  370.     {
  371.         $this->slug $slug;
  372.         return $this;
  373.     }
  374.     public function getCreatedAt(): ?\DateTimeImmutable
  375.     {
  376.         return $this->createdAt;
  377.     }
  378.     public function setCreatedAt(?\DateTimeImmutable $createdAt): self
  379.     {
  380.         $this->createdAt $createdAt;
  381.         return $this;
  382.     }
  383.     /**
  384.      * @return Collection|ProductVariant[]
  385.      */
  386.     public function getProductVariants(): Collection
  387.     {
  388.         return $this->productVariants;
  389.     }
  390.     public function addProductVariant(ProductVariant $productVariant): self
  391.     {
  392.         if (!$this->productVariants->contains($productVariant)) {
  393.             $this->productVariants[] = $productVariant;
  394.             $productVariant->setProduct($this);
  395.         }
  396.         return $this;
  397.     }
  398.     public function removeProductVariant(ProductVariant $productVariant): self
  399.     {
  400.         if ($this->productVariants->removeElement($productVariant)) {
  401.             // set the owning side to null (unless already changed)
  402.             if ($productVariant->getProduct() === $this) {
  403.                 $productVariant->setProduct(null);
  404.             }
  405.         }
  406.         return $this;
  407.     }
  408.     public function getIsPriceReducedPerPercent(): ?bool
  409.     {
  410.         return $this->isPriceReducedPerPercent;
  411.     }
  412.     public function setIsPriceReducedPerPercent(?bool $isPriceReducedPerPercent): self
  413.     {
  414.         $this->isPriceReducedPerPercent $isPriceReducedPerPercent;
  415.         return $this;
  416.     }
  417.     public function getPercentReduction(): ?float
  418.     {
  419.         return $this->percentReduction;
  420.     }
  421.     public function setPercentReduction(?float $percentReduction): self
  422.     {
  423.         $this->percentReduction $percentReduction;
  424.         return $this;
  425.     }
  426.     public function getSkuCode(): ?string
  427.     {
  428.         return $this->skuCode;
  429.     }
  430.     public function setSkuCode(?string $skuCode): self
  431.     {
  432.         $this->skuCode $skuCode;
  433.         return $this;
  434.     }
  435.     /**
  436.      * @return Collection|OrderItem[]
  437.      */
  438.     public function getOrderItems(): Collection
  439.     {
  440.         return $this->orderItems;
  441.     }
  442.     public function addOrderItem(OrderItem $orderItem): self
  443.     {
  444.         if (!$this->orderItems->contains($orderItem)) {
  445.             $this->orderItems[] = $orderItem;
  446.             $orderItem->setProduct($this);
  447.         }
  448.         return $this;
  449.     }
  450.     public function removeOrderItem(OrderItem $orderItem): self
  451.     {
  452.         if ($this->orderItems->removeElement($orderItem)) {
  453.             // set the owning side to null (unless already changed)
  454.             if ($orderItem->getProduct() === $this) {
  455.                 $orderItem->setProduct(null);
  456.             }
  457.         }
  458.         return $this;
  459.     }
  460.     public function getPromotion(): ?Promotion
  461.     {
  462.         return $this->promotion;
  463.     }
  464.     public function setPromotion(?Promotion $promotion): self
  465.     {
  466.         $this->promotion $promotion;
  467.         return $this;
  468.     }
  469.     #[Groups(['read''readDeep'])]
  470.     public function getFinalPrice(){
  471.        
  472.         return $this->price $this->getReduction() ;
  473.     }
  474.     public function getVendor(): ?Vendor
  475.     {
  476.         return $this->vendor;
  477.     }
  478.     public function setVendor(?Vendor $vendor): self
  479.     {
  480.         $this->vendor $vendor;
  481.         return $this;
  482.     }
  483.     public function getBrand(): ?Brand
  484.     {
  485.         return $this->brand;
  486.     }
  487.     public function setBrand(?Brand $brand): self
  488.     {
  489.         $this->brand $brand;
  490.         return $this;
  491.     }
  492.     public function getShortDescription(): ?string
  493.     {
  494.         return $this->shortDescription;
  495.     }
  496.     public function setShortDescription(?string $shortDescription): self
  497.     {
  498.         $this->shortDescription $shortDescription;
  499.         return $this;
  500.     }
  501.     public function getIsPublished(): ?bool
  502.     {
  503.         return $this->isPublished;
  504.     }
  505.     public function setIsPublished(?bool $isPublished): self
  506.     {
  507.         $this->isPublished $isPublished;
  508.         return $this;
  509.     }
  510.     /**
  511.      * @return Collection|Comment[]
  512.      */
  513.     public function getComments(): Collection
  514.     {
  515.         return $this->comments;
  516.     }
  517.     public function addComment(Comment $comment): self
  518.     {
  519.         if (!$this->comments->contains($comment)) {
  520.             $this->comments[] = $comment;
  521.             $comment->setProduct($this);
  522.         }
  523.         return $this;
  524.     }
  525.     public function removeComment(Comment $comment): self
  526.     {
  527.         if ($this->comments->removeElement($comment)) {
  528.             // set the owning side to null (unless already changed)
  529.             if ($comment->getProduct() === $this) {
  530.                 $comment->setProduct(null);
  531.             }
  532.         }
  533.         return $this;
  534.     }
  535.     public function getStars5(){
  536.         //for 5 stars
  537.         $stars5=0;
  538.         foreach($this->comments as $singleComment){
  539.             if($singleComment->getRating() == 5){
  540.                 $stars5 $stars5 1;
  541.             }
  542.             
  543.         }
  544.         return $stars5;
  545.     }
  546.     public function getStars4(){
  547.         //for 4 stars
  548.         $stars4=0;
  549.         foreach($this->comments as $singleComment){
  550.             if($singleComment->getRating() == 4){
  551.                 $stars4 $stars4 1;
  552.             }
  553.             
  554.         }
  555.         return $stars4;
  556.     }
  557.     public function getStars3(){
  558.         //for 3 stars
  559.         $stars3=0;
  560.         foreach($this->comments as $singleComment){
  561.             if($singleComment->getRating() == 3){
  562.                 $stars3 $stars3 1;
  563.             }
  564.             
  565.         }
  566.         return $stars3;
  567.     }
  568.     public function getStars2(){
  569.         //for 2 stars
  570.         $stars2=0;
  571.         foreach($this->comments as $singleComment){
  572.             if($singleComment->getRating() == 2){
  573.                 $stars2 $stars2 1;
  574.             }
  575.             
  576.         }
  577.         return $stars2;
  578.     }
  579.     public function getStars1(){
  580.         //for 5 stars
  581.         $stars1=0;
  582.         foreach($this->comments as $singleComment){
  583.             if($singleComment->getRating() == 1){
  584.                 $stars1 $stars1 1;
  585.             }
  586.             
  587.         }
  588.         return $stars1;
  589.     }
  590.     public function getRating(){
  591.         $topRating 0;
  592.         $totalRating=0;
  593.         $stars5 $this->getStars5();
  594.         $stars4 $this->getStars4();
  595.         $stars3 $this->getStars3();
  596.         $stars2 $this->getStars2();
  597.         $stars1 $this->getStars1();
  598.         $topRating = ($stars1 ) + ($stars2 ) + ($stars3 ) + ($stars4 )+ ($stars5 );
  599.         $totalRating $stars1 $stars2 +$stars3 $stars4 $stars5;
  600.         
  601.         $result 0;
  602.         if($totalRating 0){
  603.             $result $topRating $totalRating;
  604.         }
  605.         
  606.         return $result;
  607.         
  608.     }
  609.     public function getSkuCodeShop(): ?string
  610.     {
  611.         if(!$this->skuCodeShop){
  612.             return $this->skuCodeShop "OM".$this->createdAt->format("ymdhs").$this->id;
  613.         }
  614.         return $this->skuCodeShop;
  615.     }
  616.     public function setSkuCodeShop(?string $skuCodeShop): self
  617.     {
  618.         $this->skuCodeShop $skuCodeShop;
  619.         return $this;
  620.     }
  621.     public function addCategoriesProduct(CategoryProduct $categoriesProduct): self
  622.     {
  623.         if (!$this->categoriesProduct->contains($categoriesProduct)) {
  624.             $this->categoriesProduct[] = $categoriesProduct;
  625.         }
  626.         return $this;
  627.     }
  628.     public function removeCategoriesProduct(CategoryProduct $categoriesProduct): self
  629.     {
  630.         $this->categoriesProduct->removeElement($categoriesProduct);
  631.         return $this;
  632.     }
  633.     public function getEndAt(): ?\DateTimeImmutable
  634.     {
  635.         return $this->endAt;
  636.     }
  637.     public function setEndAt(?\DateTimeImmutable $endAt): self
  638.     {
  639.         $this->endAt $endAt;
  640.         return $this;
  641.     }
  642.     public function getParentCategory(): ?CategoryProduct
  643.     {
  644.         return $this->parentCategory;
  645.     }
  646.     public function setParentCategory(?CategoryProduct $parentCategory): self
  647.     {
  648.         $this->parentCategory $parentCategory;
  649.         return $this;
  650.     }
  651.     public function getClonedProduct(): ?self
  652.     {
  653.         return $this->clonedProduct;
  654.     }
  655.     public function setClonedProduct(?self $clonedProduct): self
  656.     {
  657.         $this->clonedProduct $clonedProduct;
  658.         return $this;
  659.     }
  660.     public function getTypeReduction(): ?string
  661.     {
  662.         return $this->typeReduction;
  663.     }
  664.     public function setTypeReduction(?string $typeReduction): self
  665.     {
  666.         $this->typeReduction $typeReduction;
  667.         return $this;
  668.     }
  669.     public function getValueReduction(): ?string
  670.     {
  671.         return $this->valueReduction;
  672.     }
  673.     public function setValueReduction(?string $valueReduction): self
  674.     {
  675.         $this->valueReduction $valueReduction;
  676.         return $this;
  677.     }
  678.     /**
  679.      * @return Collection<int, ProductSubscription>
  680.      */
  681.     public function getProductSubscriptions(): Collection
  682.     {
  683.         return $this->productSubscriptions;
  684.     }
  685.     public function addProductSubscription(ProductSubscription $productSubscription): self
  686.     {
  687.         if (!$this->productSubscriptions->contains($productSubscription)) {
  688.             $this->productSubscriptions->add($productSubscription);
  689.             $productSubscription->setProduct($this);
  690.         }
  691.         return $this;
  692.     }
  693.     public function removeProductSubscription(ProductSubscription $productSubscription): self
  694.     {
  695.         if ($this->productSubscriptions->removeElement($productSubscription)) {
  696.             // set the owning side to null (unless already changed)
  697.             if ($productSubscription->getProduct() === $this) {
  698.                 $productSubscription->setProduct(null);
  699.             }
  700.         }
  701.         return $this;
  702.     }
  703.     public function getSubscriptionMonthlyPrice(): ?float
  704.     {
  705.         return $this->subscriptionMonthlyPrice;
  706.     }
  707.     public function setSubscriptionMonthlyPrice(?float $subscriptionMonthlyPrice): self
  708.     {
  709.         $this->subscriptionMonthlyPrice $subscriptionMonthlyPrice;
  710.         return $this;
  711.     }
  712.     public function getSubscriptionYearlyPrice(): ?float
  713.     {
  714.         return $this->subscriptionYearlyPrice;
  715.     }
  716.     public function setSubscriptionYearlyPrice(?float $subscriptionYearlyPrice): self
  717.     {
  718.         $this->subscriptionYearlyPrice $subscriptionYearlyPrice;
  719.         return $this;
  720.     }
  721.     public function getStore(): ?Store
  722.     {
  723.         return $this->store;
  724.     }
  725.     public function setStore(?Store $store): self
  726.     {
  727.         $this->store $store;
  728.         return $this;
  729.     }
  730.    
  731.     /**
  732.      * Get the value of deletedAt
  733.      */ 
  734.     public function getDeletedAt()
  735.     {
  736.         return $this->deletedAt;
  737.     }
  738.     /**
  739.      * Set the value of deletedAt
  740.      *
  741.      * @return  self
  742.      */ 
  743.     public function setDeletedAt($deletedAt)
  744.     {
  745.         $this->deletedAt $deletedAt;
  746.         return $this;
  747.     }
  748.   
  749.     /**
  750.      * @return Collection<int, ProductPack>
  751.      */
  752.     public function getChildrenProductsPack(): Collection
  753.     {
  754.         return $this->childrenProductsPack;
  755.     }
  756.     public function addChildrenProductsPack(ProductPack $childrenPackProduct): self
  757.     {
  758.         if (!$this->childrenProductsPack->contains($childrenPackProduct)) {
  759.             $this->childrenProductsPack->add($childrenPackProduct);
  760.             $childrenPackProduct->setParentProduct($this);
  761.         }
  762.         return $this;
  763.     }
  764.     public function removeChildrenProductsPack(ProductPack $childrenPackProduct): self
  765.     {
  766.         if ($this->childrenProductsPack->removeElement($childrenPackProduct)) {
  767.             // set the owning side to null (unless already changed)
  768.             if ($childrenPackProduct->getParentProduct() === $this) {
  769.                 $childrenPackProduct->setParentProduct(null);
  770.             }
  771.         }
  772.         return $this;
  773.     }
  774.     public function isLabelPriceFrom(): ?bool
  775.     {
  776.         return $this->labelPriceFrom;
  777.     }
  778.     public function setLabelPriceFrom(?bool $labelPriceFrom): self
  779.     {
  780.         $this->labelPriceFrom $labelPriceFrom;
  781.         return $this;
  782.     }
  783.     public function getCapacity(): ?string
  784.     {
  785.         return $this->capacity;
  786.     }
  787.     public function setCapacity(?string $capacity): static
  788.     {
  789.         $this->capacity $capacity;
  790.         return $this;
  791.     }
  792.    
  793.   
  794. }