src/Entity/Product.php line 22

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Traits\Activeable;
  4. use App\Traits\Creatable;
  5. use App\Traits\Deleteable;
  6. use App\Traits\Sortable;
  7. use App\Traits\Updateable;
  8. use Doctrine\Common\Collections\ArrayCollection;
  9. use Doctrine\Common\Collections\Collection;
  10. use Doctrine\ORM\Mapping as ORM;
  11. use Gedmo\Mapping\Annotation as Gedmo;
  12. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  13. /**
  14.  * @ORM\Entity()
  15.  * @ORM\Table(name="`product`")
  16.  * @Gedmo\SoftDeleteable(fieldName="deletedAt")
  17.  * @UniqueEntity(fields={"constName", "reference"})
  18.  */
  19. class Product
  20. {
  21.     const BUSINESS_CARD 'BUSINESS_CARD';
  22.     const DIGITAL_MENU 'DIGITAL_MENU';
  23.     const ENVELOPE 'ENVELOPE';
  24.     const FLYER 'FLYER';
  25.     const FOLDED_LOYALTY_CARD 'FOLDED_LOYALTY_CARD';
  26.     const HEADED_PAPER 'HEADED_PAPER';
  27.     const LEAFLET 'LEAFLET';
  28.     const MENU_PEL 'MENU_PEL';
  29.     const MENU_PLA 'MENU_PLA';
  30.     const QRCODE_STICK_BOARD 'QRCODE_STICK_BOARD';
  31.     const SOCIAL_NETWORK 'SOCIAL_NETWORK';
  32.     const STANDARD_LOYALTY_CARD 'STANDARD_LOYALTY_CARD';
  33.     const TABLE_SET_PAPER 'TABLE_SET_PAPER';
  34.     const TABLE_SET_PLASTIC 'TABLE_SET_PLASTIC';
  35.     const MENU_HOLDER_PEL 'MENU_HOLDER_PEL';
  36.     const MENU_HOLDER_POLY_COLOR 'MENU_HOLDER_POLY_COLOR';
  37.     const MENU_HOLDER_POLY_TRANSPARENT 'MENU_HOLDER_POLY_TRANSPARENT';
  38.     const MENU_HOLDER_TEXTURED 'MENU_HOLDER_TEXTURED';
  39.     const SHEET_PROTECTOR 'SHEET_PROTECTOR';
  40.     const BACKGROUND_SHEET 'BACKGROUND_SHEET';
  41.     const INNER_SHEET 'INNER_SHEET';
  42.     const MENU_PEL__13 'MENU_PEL__13';
  43.     const MENU_PEL__A3 'MENU_PEL__A3';
  44.     const MENU_PEL__A4 'MENU_PEL__A4';
  45.     const MENU_PEL__A5 'MENU_PEL__A5';
  46.     const MENU_PEL__A6 'MENU_PEL__A6';
  47.     const MENU_PEL__CARRE 'MENU_PEL__CARRE';
  48.     use CreatableUpdateableDeleteableActiveableSortable;
  49.     /**
  50.      * @ORM\Id
  51.      * @ORM\Column(type="integer")
  52.      * @ORM\GeneratedValue(strategy="AUTO")
  53.      */
  54.     private ?int $id null;
  55.     /**
  56.      * @var ?string
  57.      *
  58.      * @ORM\Column(type="string", nullable=true, unique=true)
  59.      */
  60.     private ?string $constName null;
  61.     /**
  62.      * @var ?string
  63.      *
  64.      * @ORM\Column(type="string", nullable=true, unique=true)
  65.      */
  66.     private ?string $printComConstName null;
  67.     /**
  68.      * @var string
  69.      *
  70.      * @ORM\Column(name="reference", type="string", unique=true)
  71.      */
  72.     private string $reference;
  73.     /**
  74.      * @var ?string
  75.      *
  76.      * @ORM\Column(name="carrier_algorithm", type="text", nullable=true)
  77.      */
  78.     private ?string $carrierAlgorithm null;
  79.     /**
  80.      * @var boolean
  81.      *
  82.      * @ORM\Column(name="builder_access", type="boolean")
  83.      */
  84.     private bool $builderAccess;
  85.     /**
  86.      * @ORM\ManyToOne(targetEntity="Tax")
  87.      */
  88.     private ?Tax $tax null;
  89.     /**
  90.      * @ORM\ManyToOne(targetEntity="App\Entity\File")
  91.      */
  92.     private ?File $file null;
  93.     /**
  94.      * @ORM\ManyToMany(targetEntity="App\Entity\Category", inversedBy="products")
  95.      */
  96.     private Collection $categories;
  97.     /**
  98.      * @ORM\ManyToMany(targetEntity="ModelCategory")
  99.      * @ORM\OrderBy({"position" = "ASC"})
  100.      */
  101.     private Collection $modelCategories;
  102.     /**
  103.      * @ORM\ManyToMany(targetEntity="Folder")
  104.      */
  105.     private Collection $folders;
  106.     /**
  107.      * @ORM\ManyToMany(targetEntity="Attribut")
  108.      */
  109.     private Collection $attributs;
  110.     /**
  111.      * @ORM\OneToMany(targetEntity="ProductStep", mappedBy="product")
  112.      * @ORM\OrderBy({"position" = "ASC"})
  113.      */
  114.     private Collection $productSteps;
  115.     /**
  116.      * @ORM\OneToMany(targetEntity="App\Entity\ProductFeature", mappedBy="product", cascade={"persist"})
  117.      * @ORM\OrderBy({"position" = "ASC"})
  118.      */
  119.     private Collection $productFeatures;
  120.     /**
  121.      * @ORM\OneToMany(targetEntity="App\Entity\ProductPrice", mappedBy="product")
  122.      * @ORM\OrderBy({"step" = "ASC"})
  123.      */
  124.     private Collection $productPrices;
  125.     /**
  126.      * @ORM\OneToMany(targetEntity="App\Entity\ProductPriceMockup", mappedBy="product")
  127.      */
  128.     private Collection $productPriceMockups;
  129.     /**
  130.      * @ORM\OneToMany(targetEntity="ProductMenuMaker", mappedBy="product")
  131.      */
  132.     private Collection $productMenuMakers;
  133.     /**
  134.      * @ORM\OneToMany(targetEntity="App\Entity\ProductTranslation", mappedBy="product", cascade={"remove", "persist"})
  135.      */
  136.     private Collection $productTranslations;
  137.     /**
  138.      * @var array
  139.      */
  140.     private array $categoryPaths;
  141.     /**
  142.      * @ORM\OneToMany(targetEntity="App\Entity\AssociatedProduct", mappedBy="product", cascade={"remove", "persist"})
  143.      * @ORM\OrderBy({"position" = "ASC"})
  144.      */
  145.     private Collection $associatedProducts;
  146.     /**
  147.      * @var ?string
  148.      *
  149.      * @ORM\Column(name="url_name", type="string", unique=true, nullable=true)
  150.      */
  151.     private ?string $urlName null;
  152.     /**
  153.      * @ORM\OneToMany(targetEntity="App\Entity\ProductPicture", mappedBy="product")
  154.      * @ORM\OrderBy({"position" = "ASC"})
  155.      */
  156.     private Collection $productPictures;
  157.     /**
  158.      * @ORM\OneToMany(targetEntity="App\Entity\ProductReview", mappedBy="product")
  159.      */
  160.     private Collection $productReviews;
  161.     public function __construct()
  162.     {
  163.         $this->active false;
  164.         $this->modelCategories = new ArrayCollection();
  165.         $this->folders = new ArrayCollection();
  166.         $this->attributs = new ArrayCollection();
  167.         $this->categoryPaths = [];
  168.         $this->productSteps = new ArrayCollection();
  169.         $this->categories = new ArrayCollection();
  170.         $this->productFeatures = new ArrayCollection();
  171.         $this->productPrices = new ArrayCollection();
  172.         $this->productPictures = new ArrayCollection();
  173.         $this->productPriceMockups = new ArrayCollection();
  174.         $this->productMenuMakers = new ArrayCollection();
  175.         $this->productTranslations = new ArrayCollection();
  176.         $this->associatedProducts = new ArrayCollection();
  177.         $this->builderAccess false;
  178.     }
  179.     public function __clone()
  180.     {
  181.         $this->id null;
  182.         $this->reference .= '-copie';
  183.         $this->active false;
  184.         $this->modelCategories = new ArrayCollection();
  185.         $this->attributs = new ArrayCollection();
  186.         $this->productSteps = new ArrayCollection();
  187.         $this->categories = new ArrayCollection();
  188.         $this->productFeatures = new ArrayCollection();
  189.         $this->productPrices = new ArrayCollection();
  190.         $this->productMenuMakers = new ArrayCollection();
  191.         $this->productTranslations = new ArrayCollection();
  192.     }
  193.     public function getId(): ?int
  194.     {
  195.         return $this->id;
  196.     }
  197.     public function getConstName(): ?string
  198.     {
  199.         return $this->constName;
  200.     }
  201.     public function setConstName(?string $constName): self
  202.     {
  203.         $this->constName $constName;
  204.         return $this;
  205.     }
  206.     public function getPrintComConstName(): ?string
  207.     {
  208.         return $this->printComConstName;
  209.     }
  210.     public function setPrintComConstName(?string $printComConstName): self
  211.     {
  212.         $this->printComConstName $printComConstName;
  213.         return $this;
  214.     }
  215.     public function getReference(): ?string
  216.     {
  217.         return $this->reference;
  218.     }
  219.     public function setReference(string $reference): self
  220.     {
  221.         $this->reference $reference;
  222.         return $this;
  223.     }
  224.     public function getCarrierAlgorithm(): ?string
  225.     {
  226.         return $this->carrierAlgorithm;
  227.     }
  228.     public function setCarrierAlgorithm(?string $carrierAlgorithm): self
  229.     {
  230.         $this->carrierAlgorithm $carrierAlgorithm;
  231.         return $this;
  232.     }
  233.     public function getTax(): ?Tax
  234.     {
  235.         return $this->tax;
  236.     }
  237.     public function setTax(?Tax $tax): self
  238.     {
  239.         $this->tax $tax;
  240.         return $this;
  241.     }
  242.     public function getFile(): ?File
  243.     {
  244.         return $this->file;
  245.     }
  246.     public function setFile(?File $file): self
  247.     {
  248.         $this->file $file;
  249.         return $this;
  250.     }
  251.     /**
  252.      * @return Collection|Category[]
  253.      */
  254.     public function getCategories(): Collection|array
  255.     {
  256.         return $this->categories;
  257.     }
  258.     public function addCategory(Category $category): self
  259.     {
  260.         if (!$this->categories->contains($category)) {
  261.             $this->categories[] = $category;
  262.         }
  263.         return $this;
  264.     }
  265.     public function removeCategory(Category $category): self
  266.     {
  267.         if ($this->categories->contains($category)) {
  268.             $this->categories->removeElement($category);
  269.         }
  270.         return $this;
  271.     }
  272.     /**
  273.      * @return Collection|ModelCategory[]
  274.      */
  275.     public function getModelCategories(): Collection|array
  276.     {
  277.         return $this->modelCategories;
  278.     }
  279.     public function addModelCategory(ModelCategory $modelCategory): self
  280.     {
  281.         if (!$this->modelCategories->contains($modelCategory)) {
  282.             $this->modelCategories[] = $modelCategory;
  283.         }
  284.         return $this;
  285.     }
  286.     public function removeModelCategory(ModelCategory $modelCategory): self
  287.     {
  288.         if ($this->modelCategories->contains($modelCategory)) {
  289.             $this->modelCategories->removeElement($modelCategory);
  290.         }
  291.         return $this;
  292.     }
  293.     /**
  294.      * @return Collection|Folder[]
  295.      */
  296.     public function getFolders(): array|Collection
  297.     {
  298.         return $this->folders;
  299.     }
  300.     public function addFolder(Folder $folder): self
  301.     {
  302.         if (!$this->folders->contains($folder)) {
  303.             $this->folders[] = $folder;
  304.         }
  305.         return $this;
  306.     }
  307.     public function removeFolder(Folder $folder): self
  308.     {
  309.         $this->folders->removeElement($folder);
  310.         return $this;
  311.     }
  312.     /**
  313.      * @return Collection|Attribut[]
  314.      */
  315.     public function getAttributs(): Collection|array
  316.     {
  317.         return $this->attributs;
  318.     }
  319.     public function addAttribut(Attribut $attribut): self
  320.     {
  321.         if (!$this->attributs->contains($attribut)) {
  322.             $this->attributs[] = $attribut;
  323.         }
  324.         return $this;
  325.     }
  326.     public function removeAttribut(Attribut $attribut): self
  327.     {
  328.         if ($this->attributs->contains($attribut)) {
  329.             $this->attributs->removeElement($attribut);
  330.         }
  331.         return $this;
  332.     }
  333.     /**
  334.      * @return Collection|ProductStep[]
  335.      */
  336.     public function getProductSteps(): Collection|array
  337.     {
  338.         return $this->productSteps;
  339.     }
  340.     public function addProductStep(ProductStep $productStep): self
  341.     {
  342.         if (!$this->productSteps->contains($productStep)) {
  343.             $this->productSteps[] = $productStep;
  344.             $productStep->setProduct($this);
  345.         }
  346.         return $this;
  347.     }
  348.     public function removeProductStep(ProductStep $productStep): self
  349.     {
  350.         if ($this->productSteps->contains($productStep)) {
  351.             $this->productSteps->removeElement($productStep);
  352.             // set the owning side to null (unless already changed)
  353.             if ($productStep->getProduct() === $this) {
  354.                 $productStep->setProduct(null);
  355.             }
  356.         }
  357.         return $this;
  358.     }
  359.     /**
  360.      * @return Collection|ProductFeature[]
  361.      */
  362.     public function getProductFeatures(): Collection|array
  363.     {
  364.         return $this->productFeatures;
  365.     }
  366.     public function addProductFeature(ProductFeature $productFeature): self
  367.     {
  368.         if (!$this->productFeatures->contains($productFeature)) {
  369.             $this->productFeatures[] = $productFeature;
  370.             $productFeature->setProduct($this);
  371.         }
  372.         return $this;
  373.     }
  374.     public function removeProductFeature(ProductFeature $productFeature): self
  375.     {
  376.         if ($this->productFeatures->contains($productFeature)) {
  377.             $this->productFeatures->removeElement($productFeature);
  378.             // set the owning side to null (unless already changed)
  379.             if ($productFeature->getProduct() === $this) {
  380.                 $productFeature->setProduct(null);
  381.             }
  382.         }
  383.         return $this;
  384.     }
  385.     /**
  386.      * @return Collection|ProductPrice[]
  387.      */
  388.     public function getProductPrices(): array|Collection
  389.     {
  390.         return $this->productPrices;
  391.     }
  392.     public function addProductPrice(ProductPrice $productPrice): self
  393.     {
  394.         if (!$this->productPrices->contains($productPrice)) {
  395.             $this->productPrices[] = $productPrice;
  396.             $productPrice->setProduct($this);
  397.         }
  398.         return $this;
  399.     }
  400.     public function removeProductPrice(ProductPrice $productPrice): self
  401.     {
  402.         if ($this->productPrices->contains($productPrice)) {
  403.             $this->productPrices->removeElement($productPrice);
  404.             // set the owning side to null (unless already changed)
  405.             if ($productPrice->getProduct() === $this) {
  406.                 $productPrice->setProduct(null);
  407.             }
  408.         }
  409.         return $this;
  410.     }
  411.     /**
  412.      * @return Collection|ProductPriceMockup[]
  413.      */
  414.     public function getProductPriceMockups(): Collection|array
  415.     {
  416.         return $this->productPriceMockups;
  417.     }
  418.     public function addProductPriceMockup(ProductPriceMockup $productPriceMockup): self
  419.     {
  420.         if (!$this->productPriceMockups->contains($productPriceMockup)) {
  421.             $this->productPriceMockups[] = $productPriceMockup;
  422.             $productPriceMockup->setProduct($this);
  423.         }
  424.         return $this;
  425.     }
  426.     public function removeProductPriceMockup(ProductPriceMockup $productPriceMockup): self
  427.     {
  428.         if ($this->productPriceMockups->contains($productPriceMockup)) {
  429.             $this->productPriceMockups->removeElement($productPriceMockup);
  430.             // set the owning side to null (unless already changed)
  431.             if ($productPriceMockup->getProduct() === $this) {
  432.                 $productPriceMockup->setProduct(null);
  433.             }
  434.         }
  435.         return $this;
  436.     }
  437.     /**
  438.      * @return Collection|ProductMenuMaker[]
  439.      */
  440.     public function getProductMenuMakers(): Collection|array
  441.     {
  442.         return $this->productMenuMakers;
  443.     }
  444.     public function addProductMenuMaker(ProductMenuMaker $productMenuMaker): self
  445.     {
  446.         if (!$this->productMenuMakers->contains($productMenuMaker)) {
  447.             $this->productMenuMakers[] = $productMenuMaker;
  448.             $productMenuMaker->setProduct($this);
  449.         }
  450.         return $this;
  451.     }
  452.     public function removeProductMenuMaker(ProductMenuMaker $productMenuMaker): self
  453.     {
  454.         if ($this->productMenuMakers->contains($productMenuMaker)) {
  455.             $this->productMenuMakers->removeElement($productMenuMaker);
  456.             // set the owning side to null (unless already changed)
  457.             if ($productMenuMaker->getProduct() === $this) {
  458.                 $productMenuMaker->setProduct(null);
  459.             }
  460.         }
  461.         return $this;
  462.     }
  463.     /**
  464.      * @return Collection|ProductTranslation[]
  465.      */
  466.     public function getProductTranslations(): array|Collection
  467.     {
  468.         return $this->productTranslations;
  469.     }
  470.     public function addProductTranslation(ProductTranslation $productTranslation): self
  471.     {
  472.         if (!$this->productTranslations->contains($productTranslation)) {
  473.             $this->productTranslations[] = $productTranslation;
  474.             $productTranslation->setProduct($this);
  475.         }
  476.         return $this;
  477.     }
  478.     public function removeProductTranslation(ProductTranslation $productTranslation): self
  479.     {
  480.         if ($this->productTranslations->contains($productTranslation)) {
  481.             $this->productTranslations->removeElement($productTranslation);
  482.             // set the owning side to null (unless already changed)
  483.             if ($productTranslation->getProduct() === $this) {
  484.                 $productTranslation->setProduct(null);
  485.             }
  486.         }
  487.         return $this;
  488.     }
  489.     public function setCategoryPaths(array $path)
  490.     {
  491.         $this->categoryPaths $path;
  492.     }
  493.     public function getCategoryPaths()
  494.     {
  495.         return $this->categoryPaths;
  496.     }
  497.     /**
  498.      * @return Collection<int, AssociatedProduct>
  499.      */
  500.     public function getAssociatedProducts(): Collection
  501.     {
  502.         return $this->associatedProducts;
  503.     }
  504.     public function addAssociatedProduct(AssociatedProduct $associatedProduct): self
  505.     {
  506.         if (!$this->associatedProducts->contains($associatedProduct)) {
  507.             $this->associatedProducts[] = $associatedProduct;
  508.             $associatedProduct->setProduct($this);
  509.         }
  510.         return $this;
  511.     }
  512.     public function removeAssociatedProduct(AssociatedProduct $associatedProduct): self
  513.     {
  514.         if ($this->associatedProducts->removeElement($associatedProduct)) {
  515.             // set the owning side to null (unless already changed)
  516.             if ($associatedProduct->getProduct() === $this) {
  517.                 $associatedProduct->setProduct(null);
  518.             }
  519.         }
  520.         return $this;
  521.     }
  522.     /**
  523.      * @return Collection|Attribut[]
  524.      */
  525.     public function getAttributValids(): Collection|array
  526.     {
  527.         $attributs = new ArrayCollection();
  528.         /** @var Attribut $attribut */
  529.         foreach ($this->attributs as $attribut) {
  530.             if ($attribut->getAttributValueActives()->count() > 0) {
  531.                 if (!$attributs->contains($attribut)) {
  532.                     $attributs->add($attribut);
  533.                 }
  534.             }
  535.         }
  536.         return $attributs;
  537.     }
  538.     /**
  539.      * @return bool
  540.      */
  541.     public function hasProductPriceActive()
  542.     {
  543.         $productPriceActive false;
  544.         /** @var ProductPrice $productPrice */
  545.         foreach ($this->productPrices as $productPrice) {
  546.             if ($productPrice->isActive()) {
  547.                 $productPriceActive true;
  548.                 break;
  549.             }
  550.         }
  551.         return $productPriceActive;
  552.     }
  553.     /**
  554.      * @return bool
  555.      */
  556.     public function isCustomizable()
  557.     {
  558.         $isCustomizable false;
  559.         /** @var ProductFeature $productFeature */
  560.         foreach ($this->productFeatures as $productFeature) {
  561.             if ($productFeature->getFeature()->getFeatureFamily()->getConstName() == FeatureFamily::CUSTOMIZABLE) {
  562.                 $isCustomizable true;
  563.                 break;
  564.             }
  565.         }
  566.         return $isCustomizable;
  567.     }
  568.     /**
  569.      * @return bool
  570.      */
  571.     public function isPrintable()
  572.     {
  573.         $isPrintable false;
  574.         /** @var ProductFeature $productFeature */
  575.         foreach ($this->productFeatures as $productFeature) {
  576.             if ($productFeature->getFeature()->getFeatureFamily()->getConstName() == FeatureFamily::PRINTABLE) {
  577.                 $isPrintable true;
  578.                 break;
  579.             }
  580.         }
  581.         return $isPrintable;
  582.     }
  583.     /**
  584.      * @return bool
  585.      */
  586.     public function isClassic()
  587.     {
  588.         $isCustomizable false;
  589.         /** @var ProductFeature $productFeature */
  590.         foreach ($this->productFeatures as $productFeature) {
  591.             if ($productFeature->getFeature()->getFeatureFamily()->getConstName() == FeatureFamily::CLASSIC) {
  592.                 $isCustomizable true;
  593.                 break;
  594.             }
  595.         }
  596.         return $isCustomizable;
  597.     }
  598.     /**
  599.      * @return bool
  600.      */
  601.     public function isDeliverable()
  602.     {
  603.         $isDeliverable false;
  604.         /** @var ProductStep $productStep */
  605.         foreach ($this->productSteps as $productStep) {
  606.             if ($productStep->getStep()->getConstName() == Step::DELIVERY) {
  607.                 $isDeliverable true;
  608.                 break;
  609.             }
  610.         }
  611.         return $isDeliverable;
  612.     }
  613.     /**
  614.      * @return ProductFeature[]
  615.      */
  616.     public function getProductFeaturesIndexed()
  617.     {
  618.         $productFeatures = [];
  619.         foreach ($this->getProductFeatures() as $productFeature) {
  620.             $productFeatures[$productFeature->getFeature()->getId()] = $productFeature;
  621.         }
  622.         return $productFeatures;
  623.     }
  624.     /**
  625.      * @return ProductPrice|mixed|null
  626.      */
  627.     public function getMinProductPrice()
  628.     {
  629.         $minProductPrice null;
  630.         foreach ($this->getProductPrices() as $productPrice) {
  631.             if (is_null($minProductPrice)) {
  632.                 $minProductPrice $productPrice;
  633.             }
  634.             if ($productPrice->getPriceHt() < $minProductPrice->getPriceHt()) {
  635.                 $minProductPrice $productPrice;
  636.             }
  637.         }
  638.         return $minProductPrice;
  639.     }
  640.     /**
  641.      * @return bool
  642.      */
  643.     public function isCommandable(): bool
  644.     {
  645.         if (!$this->isActive()) {
  646.             return false;
  647.         }
  648.         if ($this->isClassic() or $this->isPrintable()) {
  649.             if (!$this->hasProductPriceActive()) {
  650.                 return false;
  651.             }
  652.         }
  653.         if ($this->isCustomizable()) {
  654.             if ($this->getProductMenuMakers()->count() == 0) {
  655.                 return false;
  656.             }
  657.             //            $haveModelCategory = false;
  658.             //
  659.             //            if ($this->getModelCategories()->count() > 0) {
  660.             //                $haveModelCategory = true;
  661.             //            }
  662.             //            $haveMatrix = false;
  663.             //            foreach ($product->getProductMenuMakers() as $productMenuMaker) {
  664.             //                if ($productMenuMaker->getMatrixActives()->count() > 0) {
  665.             //                    $haveMatrix = true;
  666.             //                }
  667.             //            }
  668.             //
  669.             //            if (!$haveModelCategory or !$haveMatrix) {
  670.             //                return false;
  671.             //            }
  672.             //            if (!$haveModelCategory) {
  673.             //                return false;
  674.             //            }
  675.             if ($this->getProductPriceMockups()->count() == 0) {
  676.                 return false;
  677.             }
  678.         }
  679.         return true;
  680.     }
  681.     public function getUrlName(): ?string
  682.     {
  683.         return $this->urlName;
  684.     }
  685.     public function setUrlName(string $urlName): self
  686.     {
  687.         $this->urlName $urlName;
  688.         return $this;
  689.     }
  690.     public function getBuilderAccess(): ?bool
  691.     {
  692.         return $this->builderAccess;
  693.     }
  694.     public function setBuilderAccess(bool $builderAccess): self
  695.     {
  696.         $this->builderAccess $builderAccess;
  697.         return $this;
  698.     }
  699.     /**
  700.      * @return Collection<int, ProductPicture>
  701.      */
  702.     public function getProductPictures(): Collection
  703.     {
  704.         return $this->productPictures;
  705.     }
  706.     public function addProductPicture(ProductPicture $productPicture): self
  707.     {
  708.         if (!$this->productPictures->contains($productPicture)) {
  709.             $this->productPictures[] = $productPicture;
  710.             $productPicture->setProduct($this);
  711.         }
  712.         return $this;
  713.     }
  714.     public function removeProductPicture(ProductPicture $productPicture): self
  715.     {
  716.         if ($this->productPictures->removeElement($productPicture)) {
  717.             // set the owning side to null (unless already changed)
  718.             if ($productPicture->getProduct() === $this) {
  719.                 $productPicture->setProduct(null);
  720.             }
  721.         }
  722.         return $this;
  723.     }
  724.     /**
  725.      * @return Collection<int, ProductReview>
  726.      */
  727.     public function getProductReviews(): Collection
  728.     {
  729.         return $this->productReviews;
  730.     }
  731.     public function addProductReview(ProductReview $productReview): self
  732.     {
  733.         if (!$this->productReviews->contains($productReview)) {
  734.             $this->productReviews[] = $productReview;
  735.             $productReview->setProduct($this);
  736.         }
  737.         return $this;
  738.     }
  739.     public function removeProductReview(ProductReview $productReview): self
  740.     {
  741.         if ($this->productReviews->removeElement($productReview)) {
  742.             // set the owning side to null (unless already changed)
  743.             if ($productReview->getProduct() === $this) {
  744.                 $productReview->setProduct(null);
  745.             }
  746.         }
  747.         return $this;
  748.     }
  749. }