src/Entity/Products.php line 106

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. use App\Filter\AttributeFilter
  30. use App\Filter\DeletedFilter
  31. use Doctrine\ORM\Mapping\Index;
  32. use ApiPlatform\Serializer\Filter\GroupFilter;
  33. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\ExistsFilter;
  34. #[ORM\Entity(repositoryClassProductsRepository::class)]
  35. #[ApiResource(
  36.     operations: [
  37.         new Get(),
  38.         new Post(),
  39.         new Delete(),
  40.         new GetCollection(),
  41.         new Put(),
  42.         new Post(
  43.             name'batch'
  44.             uriTemplate'/products/batch'
  45.             controllerBatchCreateProductAction::class
  46.         ),
  47.         new Get(
  48.             name'filter_product'
  49.             uriTemplate'/products/filter'
  50.             controllerProductController::class
  51.         )
  52.     ],
  53.     normalizationContext: ['groups' => ['product:read''prod:medium']],
  54.     denormalizationContext: ['groups' => ['product:write']],
  55.     order: ['name' => 'ASC'],
  56.     // paginationPartial: true,
  57.     paginationEnabledtrue,
  58.     // filters: [ShowProductsFilter::class] 
  59. )]
  60. // #[Get]
  61. #[ORM\HasLifecycleCallbacks]
  62. #[ApiFilter(RangeFilter::class, properties: ['balance''price'])]
  63. #[ApiFilter(DeletedFilter::class)]
  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.         'categoryCnt' => 'exact',
  85.         'deleted' => 'exact'
  86.     ],
  87. )]
  88. #[ApiFilter(AttributeFilter::class)]  
  89. #[ApiFilter(OrderFilter::class, properties: ['price''name'], arguments: ['orderParameterName' => 'order'])]
  90. #[Index(name"show"columns: ["show""deleted"])]
  91. #[ApiFilter(GroupFilter::class, arguments: ['parameterName' => 'g''overrideDefaultGroups' => true])]
  92. #[ApiFilter(ExistsFilter::class, properties: ['attributeItems'])]
  93. class Products
  94. {
  95.     #[ORM\Id]
  96.     #[ORM\GeneratedValue]
  97.     #[ORM\Column]
  98.     #[Groups(['product:read''product:admin''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',   'cat:read','product_storage_balance:read''site_product:read''product_releted:read'])]
  99.     private ?int $id null;
  100.     #[ORM\Column(length255)]
  101.     #[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',   'cat:read','product_storage_balance:read''site_product:read''product_releted:read'])]
  102.     private ?string $name null;
  103.     #[ORM\Column(typeTypes::DATETIME_MUTABLE)]
  104.     #[Groups(['product:admin'])]
  105.     private ?\DateTimeInterface $date_entered;
  106.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  107.     #[Groups(['product:admin'])]
  108.     private ?\DateTimeInterface $date_modified;
  109.     #[ORM\ManyToOne(inversedBy'products')]
  110.     #[Groups(['product:modified_user'])]
  111.     #[MaxDepth(1)]
  112.     private ?User $modified_user null;
  113.     #[ORM\ManyToOne(inversedBy'create_products')]
  114.     #[Groups(['product:created_by'])]
  115.     #[MaxDepth(1)]
  116.     private ?User $created_by;
  117.     #[Groups(['product:read''product:write''site_product:read'])]
  118.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  119.     private ?string $description null;
  120.     #[ORM\Column(length20nullabletrue)]
  121.     #[Groups([ 'product:admin''product:write''order:read''order_product:read''pre_order_product:read''pre_order:read''load_invoice:read''order_product:read''product_storage_balance:read''site_product:read'])]
  122.     private ?string $code1c null;
  123.     #[ORM\Column(length100nullabletrue)]
  124.     #[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''site_product:read''product_releted:read'])]
  125.     private ?string $barcode null;
  126.     #[ORM\Column(length100nullabletrue)]
  127.     #[Groups(['product:read''product:write'])]
  128.     private ?string $status null;
  129.     #[ORM\Column(nullabletrue)]
  130.     #[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',   'cat:read','product_storage_balance:read''site_product:read''product_releted:read'])]
  131.     private ?float $price null;
  132.     #[ORM\Column(nullabletrue)]
  133.     #[Groups([ 'product:admin''product:write''order_product:read''product_releted:read'])]
  134.     private ?float $priceIncome null;
  135.     #[ORM\Column(nullabletrue)]
  136.     #[Groups(['product:admin''product:write'])]
  137.     private ?float $mark_up null;
  138.     #[ORM\Column]
  139.     #[Groups(['product:admin''product:write'])]
  140.     private ?float $min_mark_up 1;
  141.     #[ORM\Column(length100nullabletrue)]
  142.     #[Groups(['product:write'])]
  143.     private ?string $packing_type null;
  144.     #[ORM\Column(nullabletrue)]
  145.     #[Groups(['product:write'])]
  146.     private ?float $packing_type_count null;
  147.     #[ORM\Column(nullabletrue)]
  148.     #[Groups(['product:read''product:write''order_product:read''product_releted:read'])]
  149.     private ?int $discounts null;
  150.     #[ORM\Column(nullabletrue)]
  151.     #[Groups(['product:admin''product:write'])]
  152.     private ?int $count_order null;
  153.     #[ORM\Column(nullabletrue)]
  154.     #[Groups(['product:read''product:write'])]
  155.     private ?int $productToOrder null;
  156.     #[ORM\ManyToOne]
  157.     #[Groups(['product:read''product:write''cat:read''load_invoice:read''pre_order_product:read''pre_order:read''order:read''order_product:read''product_storage_balance:read''site_product:read'])]
  158.     #[ApiProperty(writabletrue)]
  159.     #[MaxDepth(1)]
  160.     private ?MeasurmentUnit $measurement_unit null;
  161.     #[Groups(['product:productInfos''product:write''site_product:read'])]
  162.     #[MaxDepth(1)]
  163.     #[ORM\OneToMany(mappedBy'product'targetEntityProductInfo::class,)]
  164.     private ?Collection $productInfos null;
  165.     #[MaxDepth(1)]
  166.     #[Groups(['product:media''product:write''cat:read''user_like:read''pre_order_product:read''pre_order:read''order:read''order_product:read''site_product:read'])]
  167.     #[ORM\OneToMany(mappedBy'product'targetEntityMediaObject::class)]
  168.     private Collection $media;
  169.     #[MaxDepth(2)]
  170.     #[Groups(['product:incomingInvoiceProducts''product:write'])]
  171.     #[ORM\OneToMany(mappedBy'product'targetEntityIncomingInvoiceProduct::class)]
  172.     private Collection $incomingInvoiceProducts;
  173.     
  174.     private ?SecurityInterface $security null;
  175.     #[ORM\Column(length20nullabletrue)]
  176.     #[Groups(['product:read''product:write''cat:read''load_invoice:read''pre_order_product:read''pre_order:read''order:read''order_product:read''product_storage_balance:read''site_product:read''product_releted:read'])]
  177.     private ?string $article null;
  178.     #[ORM\Column(nullabletrue)]
  179.     #[Groups(['product:admin''product:write'])]
  180.     private ?float $nds null;
  181.     #[ORM\Column(nullabletrue)]
  182.     #[Groups(['product:admin''product:write'])]
  183.     private ?bool $service null;
  184.     #[ORM\Column(nullabletrue)]
  185.     #[Groups(['product:admin''product:write'])]
  186.     private ?bool $transport_service null;
  187.     #[ORM\Column(nullabletrue)]
  188.     #[Groups(['product:read''product:write'])]
  189.     private ?bool $exise false;
  190.     #[ORM\Column(nullabletrue)]
  191.     #[Groups(['product:read''product:write'])]
  192.     private ?bool $expiration_date null;
  193.     #[ORM\Column(nullabletrue)]
  194.     #[Groups(['product:read''product:write'])]
  195.     private ?float $unit_volume null;
  196.     #[ORM\Column(nullabletrue)]
  197.     #[Groups(['product:read''product:write'])]
  198.     private ?float $net_weight null;
  199.     #[ORM\Column(nullabletrue)]
  200.     #[Groups(['product:read''product:write'])]
  201.     private ?float $gross_weight null;
  202.     #[ORM\Column(nullabletrue)]
  203.     #[Groups(['product:read''product:write'])]
  204.     private ?bool $go_by_weight null;
  205.     #[ORM\Column(nullabletrue)]
  206.     #[Groups(['product:read''product:write'])]
  207.     private ?float $packaging null;
  208.     #[ORM\ManyToOne(inversedBy'products')]
  209.     #[MaxDepth(1)]
  210.     #[Groups(['product:siteProduct''product:write'])]
  211.     private ?SiteProducts $siteProduct null;
  212.     #[Groups([ 'product:category''product:write',  'attributes:read'])]
  213.     #[ORM\ManyToMany(targetEntityCategory::class, inversedBy'products')]
  214.     #[MaxDepth(1)]
  215.     private Collection $category;
  216.     
  217.     #[Groups(['product:admin''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:attributeItems''product:write''site_product:read'])]
  223.     #[ORM\ManyToMany(targetEntityAttributeItems::class, mappedBy'product')] 
  224.     private Collection $attributeItems;
  225.     #[Groups([ 'product:admin''product:write''cat:read''load_invoice:read''pre_order_product:read''pre_order:read''order:read''order_product:read''site_product:read'])]
  226.     #[ORM\Column(nullabletrue)]
  227.     private ?bool $show null;
  228.     #[Groups(['product:storage''product:write''load_invoice:read''pre_order_product:read''pre_order:read''order:read''order_product:read''site_product:read'])]
  229.     #[ORM\ManyToOne(inversedBy'products')]
  230.     private ?Storage $storage null;
  231.     #[MaxDepth(2)]
  232.     #[Groups(['product:storageElement''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:productBalanceInStorages''product:write'])]
  238.     #[ORM\OneToMany(mappedBy'product'targetEntityProductBalanceInStorage::class)]
  239.     private Collection $productBalanceInStorages;
  240.     #[Groups(['product:admin''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',   'cat:read','site_product: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.     #[Groups(['product:language''product:write'])]
  247.     #[ORM\ManyToOne(inversedBy'products')]
  248.     private ?Languages $language null;
  249.     #[Groups(['product:language''product:write'])]
  250.     #[ORM\ManyToOne(targetEntityself::class, inversedBy'products')]
  251.     private ?self $translations null;
  252.     #[ORM\OneToMany(mappedBy'translations'targetEntityself::class)]
  253.     private Collection $products;
  254.     #[Groups(['product:read''product:write''cat:read''user_like:read''pre_order_product:read''pre_order:read''order:read''order_product:read''site_product:read'])]
  255.     #[ORM\ManyToOne(inversedBy'MainProducts')]
  256.     private ?MediaObject $mainMedia null;
  257.     #[Groups(['product:admin''product:write'])]
  258.     #[ORM\Column(nullabletrueoptions: ["default" => false])]
  259.     private ?bool $deleted false;
  260.     #[Groups(['product:admin''product:write'])]
  261.     #[ORM\Column(nullabletrue,  options: ["default" => 0])]
  262.     private ?int $categoryCnt 0;
  263.     #[Groups(['product:read''product:write''pre_order_product:read''pre_order:read''order:read''order_product:read''site_product:read'])]
  264.     #[ORM\Column(nullabletrue)]
  265.     private ?array $priceCategory null;
  266.     #[Groups(['product:comments''product:write'])]
  267.     #[ORM\OneToMany(mappedBy'product'targetEntityComments::class)]
  268.     private Collection $comments;
  269.     #[Groups(['product:read''product:write'])]
  270.     #[ORM\Column(nullabletrue)]
  271.     private ?bool $isSalle null;
  272.     #[Groups(['product:read''product:write'])]
  273.     #[ORM\Column(nullabletrue)]
  274.     private ?bool $isNew null;
  275.     #[Groups(['product:read''product:write'])]
  276.     #[ORM\Column(nullabletrue)]
  277.     private ?bool $isTop null;
  278.     #[Groups(['product:hover''product:write'])]
  279.     #[ORM\ManyToOne(inversedBy'productsHover')]
  280.     private ?MediaObject $mainMediaHover null;
  281.     #[Groups(['productsReleteds:read''product:write'])]
  282.     #[ORM\OneToMany(mappedBy'product'targetEntityProductsReleted::class)]
  283.     private Collection $productsReleteds;
  284.     #[ORM\OneToMany(mappedBy'relatedProduct'targetEntityProductsReleted::class)]
  285.     private Collection $parentProductRelateds;
  286.     #[Groups(['product:read''product:write''product_releted:read'])]
  287.     #[ORM\Column(nullabletrue)]
  288.     private ?float $oldPrice null;
  289.     #[Groups(['product:read''product:write''product_releted:read'])]
  290.     #[ORM\Column(nullabletrue)]
  291.     private ?int $discountPercent null;
  292.     #[Groups(['product:read''product:write''pre_order_product:read''pre_order:read''order:read''order_product:read''site_product:read'])]
  293.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  294.     private ?\DateTimeInterface $dateLastPriceIncome null;
  295.     public function __construct() {
  296.         $this->productInfos = new ArrayCollection();
  297.         $this->media = new ArrayCollection();
  298.         $this->incomingInvoiceProducts = new ArrayCollection();
  299.         $this->category = new ArrayCollection();
  300.         // $this->mediaObjects = new ArrayCollection();
  301.         $this->userLikeLists = new ArrayCollection();
  302.         $this->attributeItems = new ArrayCollection();
  303.         $this->prices = new ArrayCollection();
  304.         $this->productBalanceInStorages = new ArrayCollection();
  305.         $this->orderProducts = new ArrayCollection();
  306.         $this->products = new ArrayCollection();
  307.         $this->comments = new ArrayCollection();
  308.         $this->productsReleteds = new ArrayCollection();
  309.         $this->parentProductRelateds = new ArrayCollection();
  310.     }
  311.     public function getId(): ?int
  312.     {
  313.         return $this->id;
  314.     }
  315.     public function setId(string $id): self
  316.     {
  317.         $this->id $id;
  318.         return $this;
  319.     }
  320.     public function getName(): ?string
  321.     {
  322.         return $this->name;
  323.     }
  324.     public function setName(string $name): self
  325.     {
  326.         $this->name $name;
  327.         return $this;
  328.     }
  329.     public function getDateEntered(): ?\DateTimeInterface
  330.     {
  331.         return $this->date_entered;
  332.     }
  333.     // public function setDateEntered(?\DateTimeInterface $date_entered): self
  334.     // {
  335.     //     $this->date_entered = $date_entered;
  336.     //     return $this;
  337.     // }
  338.     public function getDateModified(): ?\DateTimeInterface
  339.     {
  340.         return $this->date_modified;
  341.     }
  342.     // public function setDateModified(?\DateTimeInterface $date_modified): self
  343.     // {
  344.     //     $this->date_modified = $date_modified;
  345.     //     return $this;
  346.     // }
  347.     public function getModifiedUser(): ?User
  348.     {
  349.         return $this->modified_user;
  350.     }
  351.     // public function setModifiedUserId(?User $modified_user_id): self
  352.     // {
  353.     //     $this->modified_user_id = $modified_user_id;
  354.     //     return $this;
  355.     // }
  356.     public function getCreatedBy(): ?User
  357.     {
  358.         return $this->created_by;
  359.     }
  360.     public function setCreatedBy(?User $created_by): self
  361.     {
  362.         $this->created_by $created_by;
  363.         return $this;
  364.     }
  365.     public function getDescription(): ?string
  366.     {
  367.         return $this->description;
  368.     }
  369.     public function setDescription(?string $description): self
  370.     {
  371.         $this->description $description;
  372.         return $this;
  373.     }
  374.     public function getCode1c(): ?string
  375.     {
  376.         return $this->code1c;
  377.     }
  378.     public function setCode1c(?string $code1c): self
  379.     {
  380.         $this->code1c $code1c;
  381.         return $this;
  382.     }
  383.     public function getBarcode(): ?string
  384.     {
  385.         return $this->barcode;
  386.     }
  387.     public function setBarcode(?string $barcode): self
  388.     {
  389.         $this->barcode $barcode;
  390.         return $this;
  391.     }
  392.     public function getStatus(): ?string
  393.     {
  394.         return $this->status;
  395.     }
  396.     public function setStatus(?string $status): self
  397.     {
  398.         $this->status $status;
  399.         return $this;
  400.     }
  401.     public function getPrice(): ?float
  402.     {
  403.         return $this->price;
  404.     }
  405.     public function setPrice(?float $price): self
  406.     {
  407.         $this->price $price;
  408.         return $this;
  409.     }
  410.     public function getPriceIncome(): ?float
  411.     {
  412.         return $this->priceIncome;
  413.     }
  414.     public function setPriceIncome(?float $priceIncome): self
  415.     {
  416.         $this->priceIncome $priceIncome;
  417.         return $this;
  418.     }
  419.     public function getMarkUp(): ?float
  420.     {
  421.         return $this->mark_up;
  422.     }
  423.     public function setMarkUp(?float $mark_up): self
  424.     {
  425.         $this->mark_up $mark_up;
  426.         return $this;
  427.     }
  428.     public function getMinMarkUp(): ?float
  429.     {
  430.         return $this->min_mark_up;
  431.     }
  432.     public function setMinMarkUp(float $min_mark_up): self
  433.     {
  434.         $this->min_mark_up $min_mark_up;
  435.         return $this;
  436.     }
  437.     public function getPackingType(): ?string
  438.     {
  439.         return $this->packing_type;
  440.     }
  441.     public function setPackingType(?string $packing_type): self
  442.     {
  443.         $this->packing_type $packing_type;
  444.         return $this;
  445.     }
  446.     public function getPackingTypeCount(): ?float
  447.     {
  448.         return $this->packing_type_count;
  449.     }
  450.     public function setPackingTypeCount(?float $packing_type_count): self
  451.     {
  452.         $this->packing_type_count $packing_type_count;
  453.         return $this;
  454.     }
  455.     public function getDiscounts(): ?int
  456.     {
  457.         return $this->discounts;
  458.     }
  459.     public function setDiscounts(?int $discounts): self
  460.     {
  461.         $this->discounts $discounts;
  462.         return $this;
  463.     }
  464.     public function getCountOrder(): ?int
  465.     {
  466.         return $this->count_order;
  467.     }
  468.     public function setCountOrder(?int $count_order): self
  469.     {
  470.         $this->count_order $count_order;
  471.         return $this;
  472.     }
  473.     public function getProductToOrder(): ?int
  474.     {
  475.         return $this->productToOrder;
  476.     }
  477.     public function setProductToOrder(?int $productToOrder): self
  478.     {
  479.         $this->productToOrder $productToOrder;
  480.         return $this;
  481.     }
  482.     public function getMeasurementUnit(): ?MeasurmentUnit
  483.     {
  484.         return $this->measurement_unit;
  485.     }
  486.     public function setMeasurementUnit(?MeasurmentUnit $measurement_unit_id): self
  487.     {
  488.         $this->measurement_unit $measurement_unit_id;
  489.         return $this;
  490.     }
  491.     /**
  492.      * @return Collection<int, ProductInfo>
  493.      */
  494.     public function getProductInfos(): Collection
  495.     {
  496.         return $this->productInfos;
  497.     }
  498.     public function addProductInfo(ProductInfo $productInfo): self
  499.     {
  500.         if (!$this->productInfos->contains($productInfo)) {
  501.             $this->productInfos->add($productInfo);
  502.             $productInfo->setProduct($this);
  503.         }
  504.         return $this;
  505.     }
  506.     public function removeProductInfo(ProductInfo $productInfo): self
  507.     {
  508.         if ($this->productInfos->removeElement($productInfo)) {
  509.             // set the owning side to null (unless already changed)
  510.             if ($productInfo->getProduct() === $this) {
  511.                 $productInfo->setProduct(null);
  512.             }
  513.         }
  514.         return $this;
  515.     }
  516.     /**
  517.      * @return Collection<int, MediaObject>
  518.      */
  519.     public function getMedia(): Collection
  520.     {
  521.         return $this->media;
  522.     }
  523.     public function addMedium(MediaObject $medium): self
  524.     {
  525.         if (!$this->media->contains($medium)) {
  526.             $this->media->add($medium);
  527.             $medium->setProduct($this);
  528.         }
  529.         return $this;
  530.     }
  531.     public function removeMedium(MediaObject $medium): self
  532.     {
  533.         if ($this->media->removeElement($medium)) {
  534.             // set the owning side to null (unless already changed)
  535.             if ($medium->getProduct() === $this) {
  536.                 $medium->setProduct(null);
  537.             }
  538.         }
  539.         return $this;
  540.     }
  541.     /**
  542.      * @return Collection<int, IncomingInvoiceProduct>
  543.      */
  544.     public function getIncomingInvoiceProducts(): Collection
  545.     {
  546.         return $this->incomingInvoiceProducts;
  547.     }
  548.     public function addIncomingInvoiceProduct(IncomingInvoiceProduct $incomingInvoiceProduct): self
  549.     {
  550.         if (!$this->incomingInvoiceProducts->contains($incomingInvoiceProduct)) {
  551.             $this->incomingInvoiceProducts->add($incomingInvoiceProduct);
  552.             $incomingInvoiceProduct->setProduct($this);
  553.         }
  554.         return $this;
  555.     }
  556.     public function removeIncomingInvoiceProduct(IncomingInvoiceProduct $incomingInvoiceProduct): self
  557.     {
  558.         if ($this->incomingInvoiceProducts->removeElement($incomingInvoiceProduct)) {
  559.             // set the owning side to null (unless already changed)
  560.             if ($incomingInvoiceProduct->getProduct() === $this) {
  561.                 $incomingInvoiceProduct->setProduct(null);
  562.             }
  563.         }
  564.         return $this;
  565.     }
  566.     #[ORM\PrePersist]
  567.     public function setCreatedAtValue(): void
  568.     {
  569.         $this->date_entered = new \DateTime();
  570.         file_put_contents('/var/www/symfony_docker/public/errorrrrrr.log'$this->getCurrentUserId() . "\n"FILE_APPEND);
  571.         $this->created_by $this->getCurrentUserId();
  572.     }
  573.     // #[ORM\PrePersist]
  574.     #[ORM\PreUpdate]
  575.     public function setUpdatedAtValue(): void
  576.     {
  577.         file_put_contents('/var/www/symfony_docker/public/errorrrrrr.log'"222222\n"FILE_APPEND);
  578.         $this->date_modified = new \DateTime();
  579.         $this->modified_user $this->getCurrentUserId();
  580.     }
  581.     public function getCurrentUserId(): ?User
  582.     {
  583.         file_put_contents('/var/www/symfony_docker/public/errorrrrrr.log'print_r($this->securitytrue)."\n"FILE_APPEND);
  584.         if (!$this->security) {
  585.             return null;
  586.         }
  587.         $token $this->security->getToken();
  588.         if (!$token) {
  589.             return null;
  590.         }
  591.         $user $token->getUser();
  592.         if (!$user instanceof User) {
  593.             return null;
  594.         }
  595.         return $user;
  596.     }
  597.     public function __sleep()
  598.     {
  599.         return [
  600.             'modified_user',
  601.             // 'created_by',
  602.             // 'date_entered',
  603.             'date_modified'
  604.         ];
  605.     }
  606.     public function __wakeup(): void
  607.     {
  608.         $this->security null;
  609.     }
  610.     public function getArticle(): ?string
  611.     {
  612.         return $this->article;
  613.     }
  614.     public function setArticle(?string $article): self
  615.     {
  616.         $this->article $article;
  617.         return $this;
  618.     }
  619.     public function getNds(): ?float
  620.     {
  621.         return $this->nds;
  622.     }
  623.     public function setNds(?float $nds): self
  624.     {
  625.         $this->nds $nds;
  626.         return $this;
  627.     }
  628.     public function isService(): ?bool
  629.     {
  630.         return $this->service;
  631.     }
  632.     public function setService(?bool $service): self
  633.     {
  634.         $this->service $service;
  635.         return $this;
  636.     }
  637.     public function isTransportService(): ?bool
  638.     {
  639.         return $this->transport_service;
  640.     }
  641.     public function setTransportService(?bool $transport_service): self
  642.     {
  643.         $this->transport_service $transport_service;
  644.         return $this;
  645.     }
  646.     public function isExise(): ?bool
  647.     {
  648.         return $this->exise;
  649.     }
  650.     public function setExise(bool $exise): self
  651.     {
  652.         $this->exise $exise;
  653.         return $this;
  654.     }
  655.     public function isExpirationDate(): ?bool
  656.     {
  657.         return $this->expiration_date;
  658.     }
  659.     public function setExpirationDate(?bool $expiration_date): self
  660.     {
  661.         $this->expiration_date $expiration_date;
  662.         return $this;
  663.     }
  664.     public function getUnitVolume(): ?float
  665.     {
  666.         return $this->unit_volume;
  667.     }
  668.     public function setUnitVolume(?float $unit_volume): self
  669.     {
  670.         $this->unit_volume $unit_volume;
  671.         return $this;
  672.     }
  673.     public function getNetWeight(): ?float
  674.     {
  675.         return $this->net_weight;
  676.     }
  677.     public function setNetWeight(?float $net_weight): self
  678.     {
  679.         $this->net_weight $net_weight;
  680.         return $this;
  681.     }
  682.     public function getGrossWeight(): ?float
  683.     {
  684.         return $this->gross_weight;
  685.     }
  686.     public function setGrossWeight(?float $gross_weight): self
  687.     {
  688.         $this->gross_weight $gross_weight;
  689.         return $this;
  690.     }
  691.     public function isGoByWeight(): ?bool
  692.     {
  693.         return $this->go_by_weight;
  694.     }
  695.     public function setGoByWeight(?bool $go_by_weight): self
  696.     {
  697.         $this->go_by_weight $go_by_weight;
  698.         return $this;
  699.     }
  700.     public function getPackaging(): ?float
  701.     {
  702.         return $this->packaging;
  703.     }
  704.     public function setPackaging(?float $packaging): self
  705.     {
  706.         $this->packaging $packaging;
  707.         return $this;
  708.     }
  709.     public function getSiteProduct(): ?SiteProducts
  710.     {
  711.         return $this->siteProduct;
  712.     }
  713.     public function setSiteProduct(?SiteProducts $siteProduct): self
  714.     {
  715.         $this->siteProduct $siteProduct;
  716.         return $this;
  717.     }
  718.     /**
  719.      * @return Collection<int, Category>
  720.      */
  721.     public function getCategory(): Collection
  722.     {
  723.         return $this->category;
  724.     }
  725.     public function addCategory(Category $category): self
  726.     {
  727.         if (!$this->category->contains($category)) {
  728.             $this->category->add($category);
  729.         }
  730.         return $this;
  731.     }
  732.     public function removeCategory(Category $category): self
  733.     {
  734.         $this->category->removeElement($category);
  735.         return $this;
  736.     }
  737.     /**
  738.      * @return Collection<int, MediaObject>
  739.      */
  740.     public function getMediaObjects(): Collection
  741.     {
  742.         return $this->mediaObjects;
  743.     }
  744.     public function addMediaObject(MediaObject $mediaObject): self
  745.     {
  746.         if (!$this->mediaObjects->contains($mediaObject)) {
  747.             $this->mediaObjects->add($mediaObject);
  748.             $mediaObject->setProduct($this);
  749.         }
  750.         return $this;
  751.     }
  752.     public function removeMediaObject(MediaObject $mediaObject): self
  753.     {
  754.         if ($this->mediaObjects->removeElement($mediaObject)) {
  755.             // set the owning side to null (unless already changed)
  756.             if ($mediaObject->getProduct() === $this) {
  757.                 $mediaObject->setProduct(null);
  758.             }
  759.         }
  760.         return $this;
  761.     }
  762.     public function getOldCode(): ?string
  763.     {
  764.         return $this->oldCode;
  765.     }
  766.     public function setOldCode(string $oldCode): self
  767.     {
  768.         $this->oldCode $oldCode;
  769.         return $this;
  770.     }
  771.     /**
  772.      * @return Collection<int, UserLikeList>
  773.      */
  774.     public function getUserLikeLists(): Collection
  775.     {
  776.         return $this->userLikeLists;
  777.     }
  778.     public function addUserLikeList(UserLikeList $userLikeList): self
  779.     {
  780.         if (!$this->userLikeLists->contains($userLikeList)) {
  781.             $this->userLikeLists->add($userLikeList);
  782.             $userLikeList->setз�product($this);
  783.         }
  784.         return $this;
  785.     }
  786.     public function removeUserLikeList(UserLikeList $userLikeList): self
  787.     {
  788.         if ($this->userLikeLists->removeElement($userLikeList)) {
  789.             // set the owning side to null (unless already changed)
  790.             if ($userLikeList->getз�product() === $this) {
  791.                 $userLikeList->setз�product(null);
  792.             }
  793.         }
  794.         return $this;
  795.     }
  796.     /**
  797.      * @return Collection<int, AttributeItems>
  798.      */
  799.     public function getAttributeItems(): Collection
  800.     {
  801.         return $this->attributeItems;
  802.     }
  803.     public function addAttributeItem(AttributeItems $attributeItem): self
  804.     {
  805.         if (!$this->attributeItems->contains($attributeItem)) {
  806.             $this->attributeItems->add($attributeItem);
  807.             $attributeItem->addProduct($this);
  808.         }
  809.         return $this;
  810.     }
  811.     public function removeAttributeItem(AttributeItems $attributeItem): self
  812.     {
  813.         if ($this->attributeItems->removeElement($attributeItem)) {
  814.             $attributeItem->removeProduct($this);
  815.         }
  816.         return $this;
  817.     }
  818.     public function isShow(): ?bool
  819.     {
  820.         return $this->show;
  821.     }
  822.     public function setShow(?bool $show): self
  823.     {
  824.         $this->show $show;
  825.         return $this;
  826.     }
  827.     public function getStorage(): ?Storage
  828.     {
  829.         return $this->storage;
  830.     }
  831.     public function setStorage(?Storage $storage): self
  832.     {
  833.         $this->storage $storage;
  834.         return $this;
  835.     }
  836.     public function getStorageElement(): ?StorageElement
  837.     {
  838.         return $this->storageElement;
  839.     }
  840.     public function setStorageElement(?StorageElement $storageElement): self
  841.     {
  842.         $this->storageElement $storageElement;
  843.         return $this;
  844.     }
  845.     
  846.     /**
  847.      * @return Collection<int, Prices>
  848.      */
  849.     public function getPrices(): Collection
  850.     {
  851.         return $this->prices;
  852.     }
  853.     public function addPrice(Prices $price): static
  854.     {
  855.         if (!$this->prices->contains($price)) {
  856.             $this->prices->add($price);
  857.             $price->setAgreement($this);
  858.         }
  859.         return $this;
  860.     }
  861.     public function removePrice(Prices $price): static
  862.     {
  863.         if ($this->prices->removeElement($price)) {
  864.             // set the owning side to null (unless already changed)
  865.             if ($price->getAgreement() === $this) {
  866.                 $price->setAgreement(null);
  867.             }
  868.         }
  869.         return $this;
  870.     }
  871.     /**
  872.      * @return Collection<int, ProductBalanceInStorage>
  873.      */
  874.     public function getProductBalanceInStorages(): Collection
  875.     {
  876.         return $this->productBalanceInStorages;
  877.     }
  878.     public function addProductBalanceInStorage(ProductBalanceInStorage $productBalanceInStorage): self
  879.     {
  880.         if (!$this->productBalanceInStorages->contains($productBalanceInStorage)) {
  881.             $this->productBalanceInStorages->add($productBalanceInStorage);
  882.             $productBalanceInStorage->setProduct($this);
  883.         }
  884.         return $this;
  885.     }
  886.     public function removeProductBalanceInStorage(ProductBalanceInStorage $productBalanceInStorage): self
  887.     {
  888.         if ($this->productBalanceInStorages->removeElement($productBalanceInStorage)) {
  889.             // set the owning side to null (unless already changed)
  890.             if ($productBalanceInStorage->getProduct() === $this) {
  891.                 $productBalanceInStorage->setProduct(null);
  892.             }
  893.         }
  894.         return $this;
  895.     }
  896.     public function getBalance(): ?float
  897.     {
  898.         return $this->balance;
  899.     }
  900.     public function setBalance(?float $balance): self
  901.     {
  902.         $this->balance $balance;
  903.         return $this;
  904.     }
  905.     /**
  906.      * @return Collection<int, OrderProduct>
  907.      */
  908.     public function getOrderProducts(): Collection
  909.     {
  910.         return $this->orderProducts;
  911.     }
  912.     public function addOrderProduct(OrderProduct $orderProduct): self
  913.     {
  914.         if (!$this->orderProducts->contains($orderProduct)) {
  915.             $this->orderProducts->add($orderProduct);
  916.             $orderProduct->setOrder($this);
  917.         }
  918.         return $this;
  919.     }
  920.     public function removeOrderProduct(OrderProduct $orderProduct): self
  921.     {
  922.         if ($this->orderProducts->removeElement($orderProduct)) {
  923.             // set the owning side to null (unless already changed)
  924.             if ($orderProduct->getOrder() === $this) {
  925.                 $orderProduct->setOrder(null);
  926.             }
  927.         }
  928.         return $this;
  929.     }
  930.     public function getLanguage(): ?Languages
  931.     {
  932.         return $this->language;
  933.     }
  934.     public function setLanguage(?Languages $language): self
  935.     {
  936.         $this->language $language;
  937.         return $this;
  938.     }
  939.     public function getTranslations(): ?self
  940.     {
  941.         return $this->translations;
  942.     }
  943.     public function setTranslations(?self $translations): self
  944.     {
  945.         $this->translations $translations;
  946.         return $this;
  947.     }
  948.     /**
  949.      * @return Collection<int, self>
  950.      */
  951.     public function getProducts(): Collection
  952.     {
  953.         return $this->products;
  954.     }
  955.     public function addProduct(self $product): self
  956.     {
  957.         if (!$this->products->contains($product)) {
  958.             $this->products->add($product);
  959.             $product->setTranslations($this);
  960.         }
  961.         return $this;
  962.     }
  963.     public function removeProduct(self $product): self
  964.     {
  965.         if ($this->products->removeElement($product)) {
  966.             // set the owning side to null (unless already changed)
  967.             if ($product->getTranslations() === $this) {
  968.                 $product->setTranslations(null);
  969.             }
  970.         }
  971.         return $this;
  972.     }
  973.     public function getMainMedia(): ?MediaObject
  974.     {
  975.         return $this->mainMedia;
  976.     }
  977.     public function setMainMedia(?MediaObject $mainMedia): self
  978.     {
  979.         $this->mainMedia $mainMedia;
  980.         return $this;
  981.     }
  982.     public function isDeleted(): ?bool
  983.     {
  984.         return $this->deleted;
  985.     }
  986.     public function setDeleted(?bool $deleted): static
  987.     {
  988.         $this->deleted $deleted;
  989.         return $this;
  990.     }
  991.     public function getCategoryCnt(): ?int
  992.     {
  993.         return $this->categoryCnt;
  994.     }
  995.     public function setCategoryCnt(?int $categoryCnt): static
  996.     {
  997.         $this->categoryCnt $categoryCnt;
  998.         return $this;
  999.     }
  1000.     public function getPriceCategory(): ?array
  1001.     {
  1002.         return $this->priceCategory;
  1003.     }
  1004.     public function setPriceCategory(?array $priceCategory): static
  1005.     {
  1006.         $this->priceCategory $priceCategory;
  1007.         return $this;
  1008.     }
  1009.     /**
  1010.      * @return Collection<int, Comments>
  1011.      */
  1012.     public function getComments(): Collection
  1013.     {
  1014.         return $this->comments;
  1015.     }
  1016.     public function addComment(Comments $comment): static
  1017.     {
  1018.         if (!$this->comments->contains($comment)) {
  1019.             $this->comments->add($comment);
  1020.             $comment->setProduct($this);
  1021.         }
  1022.         return $this;
  1023.     }
  1024.     public function removeComment(Comments $comment): static
  1025.     {
  1026.         if ($this->comments->removeElement($comment)) {
  1027.             // set the owning side to null (unless already changed)
  1028.             if ($comment->getProduct() === $this) {
  1029.                 $comment->setProduct(null);
  1030.             }
  1031.         }
  1032.         return $this;
  1033.     }
  1034.     public function isIsSalle(): ?bool
  1035.     {
  1036.         return $this->isSalle;
  1037.     }
  1038.     public function setIsSalle(?bool $isSalle): static
  1039.     {
  1040.         $this->isSalle $isSalle;
  1041.         return $this;
  1042.     }
  1043.     public function isIsNew(): ?bool
  1044.     {
  1045.         return $this->isNew;
  1046.     }
  1047.     public function setIsNew(?bool $isNew): static
  1048.     {
  1049.         $this->isNew $isNew;
  1050.         return $this;
  1051.     }
  1052.     public function isIsTop(): ?bool
  1053.     {
  1054.         return $this->isTop;
  1055.     }
  1056.     public function setIsTop(?bool $isTop): static
  1057.     {
  1058.         $this->isTop $isTop;
  1059.         return $this;
  1060.     }
  1061.     public function getMainMediaHover(): ?MediaObject
  1062.     {
  1063.         return $this->mainMediaHover;
  1064.     }
  1065.     public function setMainMediaHover(?MediaObject $mainMediaHover): static
  1066.     {
  1067.         $this->mainMediaHover $mainMediaHover;
  1068.         return $this;
  1069.     }
  1070.     /**
  1071.      * @return Collection<int, ProductsReleted>
  1072.      */
  1073.     public function getProductsReleteds(): Collection
  1074.     {
  1075.         return $this->productsReleteds;
  1076.     }
  1077.     public function addProductsReleted(ProductsReleted $productsReleted): static
  1078.     {
  1079.         if (!$this->productsReleteds->contains($productsReleted)) {
  1080.             $this->productsReleteds->add($productsReleted);
  1081.             $productsReleted->setProduct($this);
  1082.         }
  1083.         return $this;
  1084.     }
  1085.     public function removeProductsReleted(ProductsReleted $productsReleted): static
  1086.     {
  1087.         if ($this->productsReleteds->removeElement($productsReleted)) {
  1088.             // set the owning side to null (unless already changed)
  1089.             if ($productsReleted->getProduct() === $this) {
  1090.                 $productsReleted->setProduct(null);
  1091.             }
  1092.         }
  1093.         return $this;
  1094.     }
  1095.     /**
  1096.      * @return Collection<int, ProductsReleted>
  1097.      */
  1098.     public function getParentProductRelateds(): Collection
  1099.     {
  1100.         return $this->parentProductRelateds;
  1101.     }
  1102.     public function addParentProductRelated(ProductsReleted $parentProductRelated): static
  1103.     {
  1104.         if (!$this->parentProductRelateds->contains($parentProductRelated)) {
  1105.             $this->parentProductRelateds->add($parentProductRelated);
  1106.             $parentProductRelated->setRelatedProduct($this);
  1107.         }
  1108.         return $this;
  1109.     }
  1110.     public function removeParentProductRelated(ProductsReleted $parentProductRelated): static
  1111.     {
  1112.         if ($this->parentProductRelateds->removeElement($parentProductRelated)) {
  1113.             // set the owning side to null (unless already changed)
  1114.             if ($parentProductRelated->getRelatedProduct() === $this) {
  1115.                 $parentProductRelated->setRelatedProduct(null);
  1116.             }
  1117.         }
  1118.         return $this;
  1119.     }
  1120.     public function getOldPrice(): ?float
  1121.     {
  1122.         return $this->oldPrice;
  1123.     }
  1124.     public function setOldPrice(?float $oldPrice): static
  1125.     {
  1126.         $this->oldPrice $oldPrice;
  1127.         return $this;
  1128.     }
  1129.     public function getDiscountPercent(): ?int
  1130.     {
  1131.         return $this->discountPercent;
  1132.     }
  1133.     public function setDiscountPercent(?int $discountPercent): static
  1134.     {
  1135.         $this->discountPercent $discountPercent;
  1136.         return $this;
  1137.     }
  1138.     public function getDateLastPriceIncome(): ?\DateTimeInterface
  1139.     {
  1140.         return $this->dateLastPriceIncome;
  1141.     }
  1142.     public function setDateLastPriceIncome(?\DateTimeInterface $dateLastPriceIncome): static
  1143.     {
  1144.         $this->dateLastPriceIncome $dateLastPriceIncome;
  1145.         return $this;
  1146.     }
  1147. }