src/Entity/Products.php line 104

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