src/Entity/Products.php line 81

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Metadata\ApiResource;
  4. use App\Repository\ProductsRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\DBAL\Types\Types;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use Symfony\Component\Security\Core\Security;
  10. use Symfony\Component\Security\Core\SecurityInterface;
  11. use DateTimeImmutable;
  12. use ApiPlatform\Metadata\ApiFilter;
  13. use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
  14. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\BooleanFilter;
  15. use ApiPlatform\Metadata\Get;
  16. use ApiPlatform\Metadata\GetCollection;
  17. use ApiPlatform\Metadata\Delete;
  18. use ApiPlatform\Metadata\Put;
  19. use ApiPlatform\Metadata\Post;
  20. use App\Controller\BatchCreateProductAction;
  21. use Symfony\Component\Serializer\Annotation\Groups;
  22. use ApiPlatform\Core\Annotation\ApiProperty
  23. use Symfony\Component\Serializer\Annotation\MaxDepth;
  24. use App\Filter\ShowProductsFilter;
  25. use ApiPlatform\Doctrine\Orm\Filter\OrderFilter;
  26. #[ORM\Entity(repositoryClassProductsRepository::class)]
  27. #[ApiResource(
  28.     operations: [
  29.         new Get(),
  30.         new Post(),
  31.         new Delete(),
  32.         new GetCollection(),
  33.         new Put(),
  34.         new Post(
  35.             name'batch'
  36.             uriTemplate'/products/batch'
  37.             controllerBatchCreateProductAction::class
  38.         )
  39.     ],
  40.     normalizationContext: ['groups' => ['product:read']],
  41.     denormalizationContext: ['groups' => ['product:write']],
  42.     order: ['id' => 'DESC'],
  43.     // paginationPartial: true,
  44.     paginationEnabledtrue,
  45.     // filters: [ShowProductsFilter::class] 
  46. )]
  47. // #[Get]
  48. #[ORM\HasLifecycleCallbacks]
  49. #[ApiFilter(
  50.     SearchFilter::class, 
  51.     properties: [
  52.         'oldCode' => 'exact'
  53.         'code1c' => 'exact'
  54.         'top' => 'exact'
  55.         'productToOrder' => 'exact'
  56.         'name' => 'ipartial'
  57.         'barcode' => 'exact'
  58.         'category.id' => 'exact',
  59.         'attributeItems.id' => 'exact',
  60.         'show' => 'exact',
  61.         'article' => 'exact',
  62.         'prices.product' => 'exact',
  63.         'prices.agreement' => 'exact',
  64.     ],
  65. )]
  66. #[ApiFilter(OrderFilter::class, properties: ['price''name'], arguments: ['orderParameterName' => 'order'])]
  67. // #[ApiFilter(ShowProductsFilter::class)]
  68. // #[ApiFilter(ShowProductsFilter::class)]
  69. class Products
  70. {
  71.     #[ORM\Id]
  72.     #[ORM\GeneratedValue]
  73.     #[ORM\Column]
  74.     #[Groups(['product:read''product:write''cat:read''order:read''order_product:read''pre_order_product:read''pre_order:read''load_invoice:read''user_like:read''order_product:read''attributes_items:read''attributes:read',  'cat:read','product_storage_balance:read'])]
  75.     private ?int $id null;
  76.     #[ORM\Column(length255)]
  77.     #[Groups(['product:read''product:write''cat:read''order:read''order_product:read''pre_order_product:read''pre_order:read''load_invoice:read''user_like:read''order_product:read''attributes_items:read''attributes:read',  'cat:read','product_storage_balance:read'])]
  78.     private ?string $name null;
  79.     #[ORM\Column(typeTypes::DATETIME_MUTABLE)]
  80.     #[Groups(['product:read'])]
  81.     private ?\DateTimeInterface $date_entered;
  82.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  83.     #[Groups(['product:read'])]
  84.     private ?\DateTimeInterface $date_modified;
  85.     #[ORM\ManyToOne(inversedBy'products')]
  86.     #[Groups(['product:read'])]
  87.     #[MaxDepth(1)]
  88.     private ?User $modified_user null;
  89.     #[ORM\ManyToOne(inversedBy'create_products')]
  90.     #[Groups(['product:read'])]
  91.     #[MaxDepth(1)]
  92.     private ?User $created_by;
  93.     #[Groups(['product:read''product:write'])]
  94.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  95.     private ?string $description null;
  96.     #[ORM\Column(length20nullabletrue)]
  97.     #[Groups(['product:read''product:write''order:read''order_product:read''pre_order_product:read''pre_order:read''load_invoice:read''order_product:read''product_storage_balance:read'])]
  98.     private ?string $code1c null;
  99.     #[ORM\Column(length100nullabletrue)]
  100.     #[Groups(['product:read''product:write''cat:read''order:read''order_product:read''pre_order_product:read''pre_order:read''load_invoice:read''user_like:read''order_product:read''product_storage_balance:read'])]
  101.     private ?string $barcode null;
  102.     #[ORM\Column(length100nullabletrue)]
  103.     #[Groups(['product:read''product:write'])]
  104.     private ?string $status null;
  105.     #[ORM\Column(nullabletrue)]
  106.     #[Groups(['product:read''product:write''order_product:read''cat:read''order:read''order_product:read''pre_order_product:read''pre_order:read''load_invoice:read''user_like:read''attributes_items:read''attributes:read',  'cat:read','product_storage_balance:read'])]
  107.     private ?float $price null;
  108.     #[ORM\Column(nullabletrue)]
  109.     #[Groups(['product:read''product:write''order_product:read'])]
  110.     private ?float $priceIncome null;
  111.     #[ORM\Column(nullabletrue)]
  112.     #[Groups(['product:read''product:write'])]
  113.     private ?float $mark_up null;
  114.     #[ORM\Column]
  115.     #[Groups(['product:read''product:write'])]
  116.     private ?float $min_mark_up 1;
  117.     #[ORM\Column(length100nullabletrue)]
  118.     #[Groups(['product:read''product:write'])]
  119.     private ?string $packing_type null;
  120.     #[ORM\Column(nullabletrue)]
  121.     #[Groups(['product:read''product:write'])]
  122.     private ?float $packing_type_count null;
  123.     #[ORM\Column(nullabletrue)]
  124.     #[Groups(['product:read''product:write''order_product:read'])]
  125.     private ?int $discounts null;
  126.     #[ORM\Column]
  127.     #[Groups(['product:read','cat:read''product:write'])]
  128.     private ?int $top 0;
  129.     #[ORM\Column(nullabletrue)]
  130.     #[Groups(['product:read''product:write'])]
  131.     private ?int $count_order null;
  132.     #[ORM\Column(nullabletrue)]
  133.     #[Groups(['product:read''product:write'])]
  134.     private ?int $productToOrder null;
  135.     #[ORM\ManyToOne]
  136.     #[Groups(['product:read''product:write''cat:read''load_invoice:read''pre_order_product:read''pre_order:read''order:read''order_product:read''order_product:read''product_storage_balance:read'])]
  137.     #[ApiProperty(writabletrue)]
  138.     #[MaxDepth(1)]
  139.     private ?MeasurmentUnit $measurement_unit null;
  140.     #[Groups(['product:read''product:write'])]
  141.     #[MaxDepth(1)]
  142.     #[ORM\OneToMany(mappedBy'product'targetEntityProductInfo::class,)]
  143.     private ?Collection $productInfos null;
  144.     #[MaxDepth(1)]
  145.     #[Groups(['product:read''product:write''cat:read''user_like:read''pre_order_product:read''pre_order:read''order:read''order_product:read''order_product:read'])]
  146.     #[ORM\OneToMany(mappedBy'product'targetEntityMediaObject::class)]
  147.     private Collection $media;
  148.     #[MaxDepth(2)]
  149.     #[Groups(['product:read''product:write'])]
  150.     #[ORM\OneToMany(mappedBy'product'targetEntityIncomingInvoiceProduct::class)]
  151.     private Collection $incomingInvoiceProducts;
  152.     
  153.     private ?SecurityInterface $security null;
  154.     #[ORM\Column(length20nullabletrue)]
  155.     #[Groups(['product:read''product:write'])]
  156.     private ?string $article null;
  157.     #[ORM\Column(nullabletrue)]
  158.     #[Groups(['product:read''product:write'])]
  159.     private ?float $nds null;
  160.     #[ORM\Column(nullabletrue)]
  161.     #[Groups(['product:read''product:write'])]
  162.     private ?bool $service null;
  163.     #[ORM\Column(nullabletrue)]
  164.     #[Groups(['product:read''product:write'])]
  165.     private ?bool $transport_service null;
  166.     #[ORM\Column(nullabletrue)]
  167.     #[Groups(['product:read''product:write'])]
  168.     private ?bool $exise false;
  169.     #[ORM\Column(nullabletrue)]
  170.     #[Groups(['product:read''product:write'])]
  171.     private ?bool $expiration_date null;
  172.     #[ORM\Column(nullabletrue)]
  173.     #[Groups(['product:read''product:write'])]
  174.     private ?float $unit_volume null;
  175.     #[ORM\Column(nullabletrue)]
  176.     #[Groups(['product:read''product:write'])]
  177.     private ?float $net_weight null;
  178.     #[ORM\Column(nullabletrue)]
  179.     #[Groups(['product:read''product:write'])]
  180.     private ?float $gross_weight null;
  181.     #[ORM\Column(nullabletrue)]
  182.     #[Groups(['product:read''product:write'])]
  183.     private ?bool $go_by_weight null;
  184.     #[ORM\Column(nullabletrue)]
  185.     #[Groups(['product:read''product:write'])]
  186.     private ?float $packaging null;
  187.     #[ORM\ManyToOne(inversedBy'products')]
  188.     #[MaxDepth(2)]
  189.     #[Groups(['product:read''product:write'])]
  190.     private ?SiteProducts $site_product null;
  191.     #[Groups(['product:read''product:write',  'attributes:read'])]
  192.     #[ORM\ManyToMany(targetEntityCategory::class, inversedBy'products')]
  193.     #[MaxDepth(1)]
  194.     private Collection $category;
  195.     #[ORM\OneToMany(mappedBy'product'targetEntityMediaObject::class)]
  196.     private Collection $mediaObjects;
  197.     #[Groups(['product:read''product:write'])]
  198.     #[ORM\Column(length100nullabletrue)]
  199.     private ?string $oldCode null;
  200.     #[ORM\OneToMany(mappedBy'product'targetEntityUserLikeList::class)]
  201.     private Collection $userLikeLists;
  202.     #[Groups(['product:read''product:write'])]
  203.     #[ORM\ManyToMany(targetEntityAttributeItems::class, mappedBy'product')] 
  204.     private Collection $attributeItems;
  205.     #[Groups(['product:read''product:write''cat:read''load_invoice:read''pre_order_product:read''pre_order:read''order:read''order_product:read''order_product:read'])]
  206.     #[ORM\Column(nullabletrue)]
  207.     private ?bool $show null;
  208.     #[Groups(['product:read''product:write''cat:read''load_invoice:read''pre_order_product:read''pre_order:read''order:read''order_product:read''order_product:read'])]
  209.     #[ORM\ManyToOne(inversedBy'products')]
  210.     private ?Storage $storage null;
  211.     #[MaxDepth(2)]
  212.     #[Groups(['product:read''product:write','order:read''order_product:read'])]
  213.     #[ORM\ManyToOne(inversedBy'products')]
  214.     private ?StorageElement $storageElement null;
  215.     #[ORM\OneToMany(mappedBy'product'targetEntityPrices::class)]
  216.     private Collection $prices;
  217.     #[Groups(['product:read''product:write''order_product:read''pre_order_product:read'])]
  218.     #[ORM\OneToMany(mappedBy'product'targetEntityProductBalanceInStorage::class)]
  219.     private Collection $productBalanceInStorages;
  220.     #[Groups(['product:read''product:write''cat:read''order:read''order_product:read''pre_order_product:read''pre_order:read''load_invoice:read''user_like:read''order_product:read''attributes_items:read''attributes:read',  'cat:read',])]
  221.     #[ORM\Column(nullabletrue)]
  222.     private ?float $balance null;
  223.     public function __construct() {
  224.         $this->productInfos = new ArrayCollection();
  225.         $this->media = new ArrayCollection();
  226.         $this->incomingInvoiceProducts = new ArrayCollection();
  227.         $this->category = new ArrayCollection();
  228.         $this->mediaObjects = new ArrayCollection();
  229.         $this->userLikeLists = new ArrayCollection();
  230.         $this->attributeItems = new ArrayCollection();
  231.         $this->prices = new ArrayCollection();
  232.         $this->productBalanceInStorages = new ArrayCollection();
  233.     }
  234.     public function getId(): ?int
  235.     {
  236.         return $this->id;
  237.     }
  238.     public function setId(string $id): self
  239.     {
  240.         $this->id $id;
  241.         return $this;
  242.     }
  243.     public function getName(): ?string
  244.     {
  245.         return $this->name;
  246.     }
  247.     public function setName(string $name): self
  248.     {
  249.         $this->name $name;
  250.         return $this;
  251.     }
  252.     public function getDateEntered(): ?\DateTimeInterface
  253.     {
  254.         return $this->date_entered;
  255.     }
  256.     // public function setDateEntered(?\DateTimeInterface $date_entered): self
  257.     // {
  258.     //     $this->date_entered = $date_entered;
  259.     //     return $this;
  260.     // }
  261.     public function getDateModified(): ?\DateTimeInterface
  262.     {
  263.         return $this->date_modified;
  264.     }
  265.     // public function setDateModified(?\DateTimeInterface $date_modified): self
  266.     // {
  267.     //     $this->date_modified = $date_modified;
  268.     //     return $this;
  269.     // }
  270.     public function getModifiedUser(): ?User
  271.     {
  272.         return $this->modified_user;
  273.     }
  274.     // public function setModifiedUserId(?User $modified_user_id): self
  275.     // {
  276.     //     $this->modified_user_id = $modified_user_id;
  277.     //     return $this;
  278.     // }
  279.     public function getCreatedBy(): ?User
  280.     {
  281.         return $this->created_by;
  282.     }
  283.     public function setCreatedBy(?User $created_by): self
  284.     {
  285.         $this->created_by $created_by;
  286.         return $this;
  287.     }
  288.     public function getDescription(): ?string
  289.     {
  290.         return $this->description;
  291.     }
  292.     public function setDescription(?string $description): self
  293.     {
  294.         $this->description $description;
  295.         return $this;
  296.     }
  297.     public function getCode1c(): ?string
  298.     {
  299.         return $this->code1c;
  300.     }
  301.     public function setCode1c(?string $code1c): self
  302.     {
  303.         $this->code1c $code1c;
  304.         return $this;
  305.     }
  306.     public function getBarcode(): ?string
  307.     {
  308.         return $this->barcode;
  309.     }
  310.     public function setBarcode(?string $barcode): self
  311.     {
  312.         $this->barcode $barcode;
  313.         return $this;
  314.     }
  315.     public function getStatus(): ?string
  316.     {
  317.         return $this->status;
  318.     }
  319.     public function setStatus(?string $status): self
  320.     {
  321.         $this->status $status;
  322.         return $this;
  323.     }
  324.     public function getPrice(): ?float
  325.     {
  326.         return $this->price;
  327.     }
  328.     public function setPrice(?float $price): self
  329.     {
  330.         $this->price $price;
  331.         return $this;
  332.     }
  333.     public function getPriceIncome(): ?float
  334.     {
  335.         return $this->priceIncome;
  336.     }
  337.     public function setPriceIncome(?float $priceIncome): self
  338.     {
  339.         $this->priceIncome $priceIncome;
  340.         return $this;
  341.     }
  342.     public function getMarkUp(): ?float
  343.     {
  344.         return $this->mark_up;
  345.     }
  346.     public function setMarkUp(?float $mark_up): self
  347.     {
  348.         $this->mark_up $mark_up;
  349.         return $this;
  350.     }
  351.     public function getMinMarkUp(): ?float
  352.     {
  353.         return $this->min_mark_up;
  354.     }
  355.     public function setMinMarkUp(float $min_mark_up): self
  356.     {
  357.         $this->min_mark_up $min_mark_up;
  358.         return $this;
  359.     }
  360.     public function getPackingType(): ?string
  361.     {
  362.         return $this->packing_type;
  363.     }
  364.     public function setPackingType(?string $packing_type): self
  365.     {
  366.         $this->packing_type $packing_type;
  367.         return $this;
  368.     }
  369.     public function getPackingTypeCount(): ?float
  370.     {
  371.         return $this->packing_type_count;
  372.     }
  373.     public function setPackingTypeCount(?float $packing_type_count): self
  374.     {
  375.         $this->packing_type_count $packing_type_count;
  376.         return $this;
  377.     }
  378.     public function getDiscounts(): ?int
  379.     {
  380.         return $this->discounts;
  381.     }
  382.     public function setDiscounts(?int $discounts): self
  383.     {
  384.         $this->discounts $discounts;
  385.         return $this;
  386.     }
  387.     public function getTop(): ?int
  388.     {
  389.         return $this->top;
  390.     }
  391.     public function setTop(int $top): self
  392.     {
  393.         $this->top $top;
  394.         return $this;
  395.     }
  396.     public function getCountOrder(): ?int
  397.     {
  398.         return $this->count_order;
  399.     }
  400.     public function setCountOrder(?int $count_order): self
  401.     {
  402.         $this->count_order $count_order;
  403.         return $this;
  404.     }
  405.     public function getProductToOrder(): ?int
  406.     {
  407.         return $this->productToOrder;
  408.     }
  409.     public function setProductToOrder(?int $productToOrder): self
  410.     {
  411.         $this->productToOrder $productToOrder;
  412.         return $this;
  413.     }
  414.     public function getMeasurementUnit(): ?MeasurmentUnit
  415.     {
  416.         return $this->measurement_unit;
  417.     }
  418.     public function setMeasurementUnit(?MeasurmentUnit $measurement_unit_id): self
  419.     {
  420.         $this->measurement_unit $measurement_unit_id;
  421.         return $this;
  422.     }
  423.     /**
  424.      * @return Collection<int, ProductInfo>
  425.      */
  426.     public function getProductInfos(): Collection
  427.     {
  428.         return $this->productInfos;
  429.     }
  430.     public function addProductInfo(ProductInfo $productInfo): self
  431.     {
  432.         if (!$this->productInfos->contains($productInfo)) {
  433.             $this->productInfos->add($productInfo);
  434.             $productInfo->setProduct($this);
  435.         }
  436.         return $this;
  437.     }
  438.     public function removeProductInfo(ProductInfo $productInfo): self
  439.     {
  440.         if ($this->productInfos->removeElement($productInfo)) {
  441.             // set the owning side to null (unless already changed)
  442.             if ($productInfo->getProduct() === $this) {
  443.                 $productInfo->setProduct(null);
  444.             }
  445.         }
  446.         return $this;
  447.     }
  448.     /**
  449.      * @return Collection<int, MediaObject>
  450.      */
  451.     public function getMedia(): Collection
  452.     {
  453.         return $this->media;
  454.     }
  455.     public function addMedium(MediaObject $medium): self
  456.     {
  457.         if (!$this->media->contains($medium)) {
  458.             $this->media->add($medium);
  459.             $medium->setProduct($this);
  460.         }
  461.         return $this;
  462.     }
  463.     public function removeMedium(MediaObject $medium): self
  464.     {
  465.         if ($this->media->removeElement($medium)) {
  466.             // set the owning side to null (unless already changed)
  467.             if ($medium->getProduct() === $this) {
  468.                 $medium->setProduct(null);
  469.             }
  470.         }
  471.         return $this;
  472.     }
  473.     /**
  474.      * @return Collection<int, IncomingInvoiceProduct>
  475.      */
  476.     public function getIncomingInvoiceProducts(): Collection
  477.     {
  478.         return $this->incomingInvoiceProducts;
  479.     }
  480.     public function addIncomingInvoiceProduct(IncomingInvoiceProduct $incomingInvoiceProduct): self
  481.     {
  482.         if (!$this->incomingInvoiceProducts->contains($incomingInvoiceProduct)) {
  483.             $this->incomingInvoiceProducts->add($incomingInvoiceProduct);
  484.             $incomingInvoiceProduct->setProduct($this);
  485.         }
  486.         return $this;
  487.     }
  488.     public function removeIncomingInvoiceProduct(IncomingInvoiceProduct $incomingInvoiceProduct): self
  489.     {
  490.         if ($this->incomingInvoiceProducts->removeElement($incomingInvoiceProduct)) {
  491.             // set the owning side to null (unless already changed)
  492.             if ($incomingInvoiceProduct->getProduct() === $this) {
  493.                 $incomingInvoiceProduct->setProduct(null);
  494.             }
  495.         }
  496.         return $this;
  497.     }
  498.     #[ORM\PrePersist]
  499.     public function setCreatedAtValue(): void
  500.     {
  501.         $this->date_entered = new \DateTime();
  502.         file_put_contents('/var/www/symfony_docker/public/errorrrrrr.log'$this->getCurrentUserId() . "\n"FILE_APPEND);
  503.         $this->created_by $this->getCurrentUserId();
  504.     }
  505.     // #[ORM\PrePersist]
  506.     #[ORM\PreUpdate]
  507.     public function setUpdatedAtValue(): void
  508.     {
  509.         file_put_contents('/var/www/symfony_docker/public/errorrrrrr.log'"222222\n"FILE_APPEND);
  510.         $this->date_modified = new \DateTime();
  511.         $this->modified_user $this->getCurrentUserId();
  512.     }
  513.     public function getCurrentUserId(): ?User
  514.     {
  515.         file_put_contents('/var/www/symfony_docker/public/errorrrrrr.log'print_r($this->securitytrue)."\n"FILE_APPEND);
  516.         if (!$this->security) {
  517.             return null;
  518.         }
  519.         $token $this->security->getToken();
  520.         if (!$token) {
  521.             return null;
  522.         }
  523.         $user $token->getUser();
  524.         if (!$user instanceof User) {
  525.             return null;
  526.         }
  527.         return $user;
  528.     }
  529.     public function __sleep()
  530.     {
  531.         return [
  532.             'modified_user',
  533.             // 'created_by',
  534.             // 'date_entered',
  535.             'date_modified'
  536.         ];
  537.     }
  538.     public function __wakeup(): void
  539.     {
  540.         $this->security null;
  541.     }
  542.     public function getArticle(): ?string
  543.     {
  544.         return $this->article;
  545.     }
  546.     public function setArticle(?string $article): self
  547.     {
  548.         $this->article $article;
  549.         return $this;
  550.     }
  551.     public function getNds(): ?float
  552.     {
  553.         return $this->nds;
  554.     }
  555.     public function setNds(?float $nds): self
  556.     {
  557.         $this->nds $nds;
  558.         return $this;
  559.     }
  560.     public function isService(): ?bool
  561.     {
  562.         return $this->service;
  563.     }
  564.     public function setService(?bool $service): self
  565.     {
  566.         $this->service $service;
  567.         return $this;
  568.     }
  569.     public function isTransportService(): ?bool
  570.     {
  571.         return $this->transport_service;
  572.     }
  573.     public function setTransportService(?bool $transport_service): self
  574.     {
  575.         $this->transport_service $transport_service;
  576.         return $this;
  577.     }
  578.     public function isExise(): ?bool
  579.     {
  580.         return $this->exise;
  581.     }
  582.     public function setExise(bool $exise): self
  583.     {
  584.         $this->exise $exise;
  585.         return $this;
  586.     }
  587.     public function isExpirationDate(): ?bool
  588.     {
  589.         return $this->expiration_date;
  590.     }
  591.     public function setExpirationDate(?bool $expiration_date): self
  592.     {
  593.         $this->expiration_date $expiration_date;
  594.         return $this;
  595.     }
  596.     public function getUnitVolume(): ?float
  597.     {
  598.         return $this->unit_volume;
  599.     }
  600.     public function setUnitVolume(?float $unit_volume): self
  601.     {
  602.         $this->unit_volume $unit_volume;
  603.         return $this;
  604.     }
  605.     public function getNetWeight(): ?float
  606.     {
  607.         return $this->net_weight;
  608.     }
  609.     public function setNetWeight(?float $net_weight): self
  610.     {
  611.         $this->net_weight $net_weight;
  612.         return $this;
  613.     }
  614.     public function getGrossWeight(): ?float
  615.     {
  616.         return $this->gross_weight;
  617.     }
  618.     public function setGrossWeight(?float $gross_weight): self
  619.     {
  620.         $this->gross_weight $gross_weight;
  621.         return $this;
  622.     }
  623.     public function isGoByWeight(): ?bool
  624.     {
  625.         return $this->go_by_weight;
  626.     }
  627.     public function setGoByWeight(?bool $go_by_weight): self
  628.     {
  629.         $this->go_by_weight $go_by_weight;
  630.         return $this;
  631.     }
  632.     public function getPackaging(): ?float
  633.     {
  634.         return $this->packaging;
  635.     }
  636.     public function setPackaging(?float $packaging): self
  637.     {
  638.         $this->packaging $packaging;
  639.         return $this;
  640.     }
  641.     public function getSiteProduct(): ?SiteProducts
  642.     {
  643.         return $this->site_product;
  644.     }
  645.     public function setSiteProduct(?SiteProducts $site_product): self
  646.     {
  647.         $this->site_product $site_product;
  648.         return $this;
  649.     }
  650.     /**
  651.      * @return Collection<int, Category>
  652.      */
  653.     public function getCategory(): Collection
  654.     {
  655.         return $this->category;
  656.     }
  657.     public function addCategory(Category $category): self
  658.     {
  659.         if (!$this->category->contains($category)) {
  660.             $this->category->add($category);
  661.         }
  662.         return $this;
  663.     }
  664.     public function removeCategory(Category $category): self
  665.     {
  666.         $this->category->removeElement($category);
  667.         return $this;
  668.     }
  669.     /**
  670.      * @return Collection<int, MediaObject>
  671.      */
  672.     public function getMediaObjects(): Collection
  673.     {
  674.         return $this->mediaObjects;
  675.     }
  676.     public function addMediaObject(MediaObject $mediaObject): self
  677.     {
  678.         if (!$this->mediaObjects->contains($mediaObject)) {
  679.             $this->mediaObjects->add($mediaObject);
  680.             $mediaObject->setProduct($this);
  681.         }
  682.         return $this;
  683.     }
  684.     public function removeMediaObject(MediaObject $mediaObject): self
  685.     {
  686.         if ($this->mediaObjects->removeElement($mediaObject)) {
  687.             // set the owning side to null (unless already changed)
  688.             if ($mediaObject->getProduct() === $this) {
  689.                 $mediaObject->setProduct(null);
  690.             }
  691.         }
  692.         return $this;
  693.     }
  694.     public function getOldCode(): ?string
  695.     {
  696.         return $this->oldCode;
  697.     }
  698.     public function setOldCode(string $oldCode): self
  699.     {
  700.         $this->oldCode $oldCode;
  701.         return $this;
  702.     }
  703.     /**
  704.      * @return Collection<int, UserLikeList>
  705.      */
  706.     public function getUserLikeLists(): Collection
  707.     {
  708.         return $this->userLikeLists;
  709.     }
  710.     public function addUserLikeList(UserLikeList $userLikeList): self
  711.     {
  712.         if (!$this->userLikeLists->contains($userLikeList)) {
  713.             $this->userLikeLists->add($userLikeList);
  714.             $userLikeList->setз�product($this);
  715.         }
  716.         return $this;
  717.     }
  718.     public function removeUserLikeList(UserLikeList $userLikeList): self
  719.     {
  720.         if ($this->userLikeLists->removeElement($userLikeList)) {
  721.             // set the owning side to null (unless already changed)
  722.             if ($userLikeList->getз�product() === $this) {
  723.                 $userLikeList->setз�product(null);
  724.             }
  725.         }
  726.         return $this;
  727.     }
  728.     /**
  729.      * @return Collection<int, AttributeItems>
  730.      */
  731.     public function getAttributeItems(): Collection
  732.     {
  733.         return $this->attributeItems;
  734.     }
  735.     public function addAttributeItem(AttributeItems $attributeItem): self
  736.     {
  737.         if (!$this->attributeItems->contains($attributeItem)) {
  738.             $this->attributeItems->add($attributeItem);
  739.             $attributeItem->addProduct($this);
  740.         }
  741.         return $this;
  742.     }
  743.     public function removeAttributeItem(AttributeItems $attributeItem): self
  744.     {
  745.         if ($this->attributeItems->removeElement($attributeItem)) {
  746.             $attributeItem->removeProduct($this);
  747.         }
  748.         return $this;
  749.     }
  750.     public function isShow(): ?bool
  751.     {
  752.         return $this->show;
  753.     }
  754.     public function setShow(?bool $show): self
  755.     {
  756.         $this->show $show;
  757.         return $this;
  758.     }
  759.     public function getStorage(): ?Storage
  760.     {
  761.         return $this->storage;
  762.     }
  763.     public function setStorage(?Storage $storage): self
  764.     {
  765.         $this->storage $storage;
  766.         return $this;
  767.     }
  768.     public function getStorageElement(): ?StorageElement
  769.     {
  770.         return $this->storageElement;
  771.     }
  772.     public function setStorageElement(?StorageElement $storageElement): self
  773.     {
  774.         $this->storageElement $storageElement;
  775.         return $this;
  776.     }
  777.     
  778.     /**
  779.      * @return Collection<int, Prices>
  780.      */
  781.     public function getPrices(): Collection
  782.     {
  783.         return $this->prices;
  784.     }
  785.     public function addPrice(Prices $price): static
  786.     {
  787.         if (!$this->prices->contains($price)) {
  788.             $this->prices->add($price);
  789.             $price->setAgreement($this);
  790.         }
  791.         return $this;
  792.     }
  793.     public function removePrice(Prices $price): static
  794.     {
  795.         if ($this->prices->removeElement($price)) {
  796.             // set the owning side to null (unless already changed)
  797.             if ($price->getAgreement() === $this) {
  798.                 $price->setAgreement(null);
  799.             }
  800.         }
  801.         return $this;
  802.     }
  803.     /**
  804.      * @return Collection<int, ProductBalanceInStorage>
  805.      */
  806.     public function getProductBalanceInStorages(): Collection
  807.     {
  808.         return $this->productBalanceInStorages;
  809.     }
  810.     public function addProductBalanceInStorage(ProductBalanceInStorage $productBalanceInStorage): self
  811.     {
  812.         if (!$this->productBalanceInStorages->contains($productBalanceInStorage)) {
  813.             $this->productBalanceInStorages->add($productBalanceInStorage);
  814.             $productBalanceInStorage->setProduct($this);
  815.         }
  816.         return $this;
  817.     }
  818.     public function removeProductBalanceInStorage(ProductBalanceInStorage $productBalanceInStorage): self
  819.     {
  820.         if ($this->productBalanceInStorages->removeElement($productBalanceInStorage)) {
  821.             // set the owning side to null (unless already changed)
  822.             if ($productBalanceInStorage->getProduct() === $this) {
  823.                 $productBalanceInStorage->setProduct(null);
  824.             }
  825.         }
  826.         return $this;
  827.     }
  828.     public function getBalance(): ?float
  829.     {
  830.         return $this->balance;
  831.     }
  832.     public function setBalance(?float $balance): self
  833.     {
  834.         $this->balance $balance;
  835.         return $this;
  836.     }
  837. }