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

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