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''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''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''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''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''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''order_product:read''pre_order_product:read'])]
  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.     public function __construct() {
  293.         $this->productInfos = new ArrayCollection();
  294.         $this->media = new ArrayCollection();
  295.         $this->incomingInvoiceProducts = new ArrayCollection();
  296.         $this->category = new ArrayCollection();
  297.         // $this->mediaObjects = new ArrayCollection();
  298.         $this->userLikeLists = new ArrayCollection();
  299.         $this->attributeItems = new ArrayCollection();
  300.         $this->prices = new ArrayCollection();
  301.         $this->productBalanceInStorages = new ArrayCollection();
  302.         $this->orderProducts = new ArrayCollection();
  303.         $this->products = new ArrayCollection();
  304.         $this->comments = new ArrayCollection();
  305.         $this->productsReleteds = new ArrayCollection();
  306.         $this->parentProductRelateds = new ArrayCollection();
  307.     }
  308.     public function getId(): ?int
  309.     {
  310.         return $this->id;
  311.     }
  312.     public function setId(string $id): self
  313.     {
  314.         $this->id $id;
  315.         return $this;
  316.     }
  317.     public function getName(): ?string
  318.     {
  319.         return $this->name;
  320.     }
  321.     public function setName(string $name): self
  322.     {
  323.         $this->name $name;
  324.         return $this;
  325.     }
  326.     public function getDateEntered(): ?\DateTimeInterface
  327.     {
  328.         return $this->date_entered;
  329.     }
  330.     // public function setDateEntered(?\DateTimeInterface $date_entered): self
  331.     // {
  332.     //     $this->date_entered = $date_entered;
  333.     //     return $this;
  334.     // }
  335.     public function getDateModified(): ?\DateTimeInterface
  336.     {
  337.         return $this->date_modified;
  338.     }
  339.     // public function setDateModified(?\DateTimeInterface $date_modified): self
  340.     // {
  341.     //     $this->date_modified = $date_modified;
  342.     //     return $this;
  343.     // }
  344.     public function getModifiedUser(): ?User
  345.     {
  346.         return $this->modified_user;
  347.     }
  348.     // public function setModifiedUserId(?User $modified_user_id): self
  349.     // {
  350.     //     $this->modified_user_id = $modified_user_id;
  351.     //     return $this;
  352.     // }
  353.     public function getCreatedBy(): ?User
  354.     {
  355.         return $this->created_by;
  356.     }
  357.     public function setCreatedBy(?User $created_by): self
  358.     {
  359.         $this->created_by $created_by;
  360.         return $this;
  361.     }
  362.     public function getDescription(): ?string
  363.     {
  364.         return $this->description;
  365.     }
  366.     public function setDescription(?string $description): self
  367.     {
  368.         $this->description $description;
  369.         return $this;
  370.     }
  371.     public function getCode1c(): ?string
  372.     {
  373.         return $this->code1c;
  374.     }
  375.     public function setCode1c(?string $code1c): self
  376.     {
  377.         $this->code1c $code1c;
  378.         return $this;
  379.     }
  380.     public function getBarcode(): ?string
  381.     {
  382.         return $this->barcode;
  383.     }
  384.     public function setBarcode(?string $barcode): self
  385.     {
  386.         $this->barcode $barcode;
  387.         return $this;
  388.     }
  389.     public function getStatus(): ?string
  390.     {
  391.         return $this->status;
  392.     }
  393.     public function setStatus(?string $status): self
  394.     {
  395.         $this->status $status;
  396.         return $this;
  397.     }
  398.     public function getPrice(): ?float
  399.     {
  400.         return $this->price;
  401.     }
  402.     public function setPrice(?float $price): self
  403.     {
  404.         $this->price $price;
  405.         return $this;
  406.     }
  407.     public function getPriceIncome(): ?float
  408.     {
  409.         return $this->priceIncome;
  410.     }
  411.     public function setPriceIncome(?float $priceIncome): self
  412.     {
  413.         $this->priceIncome $priceIncome;
  414.         return $this;
  415.     }
  416.     public function getMarkUp(): ?float
  417.     {
  418.         return $this->mark_up;
  419.     }
  420.     public function setMarkUp(?float $mark_up): self
  421.     {
  422.         $this->mark_up $mark_up;
  423.         return $this;
  424.     }
  425.     public function getMinMarkUp(): ?float
  426.     {
  427.         return $this->min_mark_up;
  428.     }
  429.     public function setMinMarkUp(float $min_mark_up): self
  430.     {
  431.         $this->min_mark_up $min_mark_up;
  432.         return $this;
  433.     }
  434.     public function getPackingType(): ?string
  435.     {
  436.         return $this->packing_type;
  437.     }
  438.     public function setPackingType(?string $packing_type): self
  439.     {
  440.         $this->packing_type $packing_type;
  441.         return $this;
  442.     }
  443.     public function getPackingTypeCount(): ?float
  444.     {
  445.         return $this->packing_type_count;
  446.     }
  447.     public function setPackingTypeCount(?float $packing_type_count): self
  448.     {
  449.         $this->packing_type_count $packing_type_count;
  450.         return $this;
  451.     }
  452.     public function getDiscounts(): ?int
  453.     {
  454.         return $this->discounts;
  455.     }
  456.     public function setDiscounts(?int $discounts): self
  457.     {
  458.         $this->discounts $discounts;
  459.         return $this;
  460.     }
  461.     public function getCountOrder(): ?int
  462.     {
  463.         return $this->count_order;
  464.     }
  465.     public function setCountOrder(?int $count_order): self
  466.     {
  467.         $this->count_order $count_order;
  468.         return $this;
  469.     }
  470.     public function getProductToOrder(): ?int
  471.     {
  472.         return $this->productToOrder;
  473.     }
  474.     public function setProductToOrder(?int $productToOrder): self
  475.     {
  476.         $this->productToOrder $productToOrder;
  477.         return $this;
  478.     }
  479.     public function getMeasurementUnit(): ?MeasurmentUnit
  480.     {
  481.         return $this->measurement_unit;
  482.     }
  483.     public function setMeasurementUnit(?MeasurmentUnit $measurement_unit_id): self
  484.     {
  485.         $this->measurement_unit $measurement_unit_id;
  486.         return $this;
  487.     }
  488.     /**
  489.      * @return Collection<int, ProductInfo>
  490.      */
  491.     public function getProductInfos(): Collection
  492.     {
  493.         return $this->productInfos;
  494.     }
  495.     public function addProductInfo(ProductInfo $productInfo): self
  496.     {
  497.         if (!$this->productInfos->contains($productInfo)) {
  498.             $this->productInfos->add($productInfo);
  499.             $productInfo->setProduct($this);
  500.         }
  501.         return $this;
  502.     }
  503.     public function removeProductInfo(ProductInfo $productInfo): self
  504.     {
  505.         if ($this->productInfos->removeElement($productInfo)) {
  506.             // set the owning side to null (unless already changed)
  507.             if ($productInfo->getProduct() === $this) {
  508.                 $productInfo->setProduct(null);
  509.             }
  510.         }
  511.         return $this;
  512.     }
  513.     /**
  514.      * @return Collection<int, MediaObject>
  515.      */
  516.     public function getMedia(): Collection
  517.     {
  518.         return $this->media;
  519.     }
  520.     public function addMedium(MediaObject $medium): self
  521.     {
  522.         if (!$this->media->contains($medium)) {
  523.             $this->media->add($medium);
  524.             $medium->setProduct($this);
  525.         }
  526.         return $this;
  527.     }
  528.     public function removeMedium(MediaObject $medium): self
  529.     {
  530.         if ($this->media->removeElement($medium)) {
  531.             // set the owning side to null (unless already changed)
  532.             if ($medium->getProduct() === $this) {
  533.                 $medium->setProduct(null);
  534.             }
  535.         }
  536.         return $this;
  537.     }
  538.     /**
  539.      * @return Collection<int, IncomingInvoiceProduct>
  540.      */
  541.     public function getIncomingInvoiceProducts(): Collection
  542.     {
  543.         return $this->incomingInvoiceProducts;
  544.     }
  545.     public function addIncomingInvoiceProduct(IncomingInvoiceProduct $incomingInvoiceProduct): self
  546.     {
  547.         if (!$this->incomingInvoiceProducts->contains($incomingInvoiceProduct)) {
  548.             $this->incomingInvoiceProducts->add($incomingInvoiceProduct);
  549.             $incomingInvoiceProduct->setProduct($this);
  550.         }
  551.         return $this;
  552.     }
  553.     public function removeIncomingInvoiceProduct(IncomingInvoiceProduct $incomingInvoiceProduct): self
  554.     {
  555.         if ($this->incomingInvoiceProducts->removeElement($incomingInvoiceProduct)) {
  556.             // set the owning side to null (unless already changed)
  557.             if ($incomingInvoiceProduct->getProduct() === $this) {
  558.                 $incomingInvoiceProduct->setProduct(null);
  559.             }
  560.         }
  561.         return $this;
  562.     }
  563.     #[ORM\PrePersist]
  564.     public function setCreatedAtValue(): void
  565.     {
  566.         $this->date_entered = new \DateTime();
  567.         file_put_contents('/var/www/symfony_docker/public/errorrrrrr.log'$this->getCurrentUserId() . "\n"FILE_APPEND);
  568.         $this->created_by $this->getCurrentUserId();
  569.     }
  570.     // #[ORM\PrePersist]
  571.     #[ORM\PreUpdate]
  572.     public function setUpdatedAtValue(): void
  573.     {
  574.         file_put_contents('/var/www/symfony_docker/public/errorrrrrr.log'"222222\n"FILE_APPEND);
  575.         $this->date_modified = new \DateTime();
  576.         $this->modified_user $this->getCurrentUserId();
  577.     }
  578.     public function getCurrentUserId(): ?User
  579.     {
  580.         file_put_contents('/var/www/symfony_docker/public/errorrrrrr.log'print_r($this->securitytrue)."\n"FILE_APPEND);
  581.         if (!$this->security) {
  582.             return null;
  583.         }
  584.         $token $this->security->getToken();
  585.         if (!$token) {
  586.             return null;
  587.         }
  588.         $user $token->getUser();
  589.         if (!$user instanceof User) {
  590.             return null;
  591.         }
  592.         return $user;
  593.     }
  594.     public function __sleep()
  595.     {
  596.         return [
  597.             'modified_user',
  598.             // 'created_by',
  599.             // 'date_entered',
  600.             'date_modified'
  601.         ];
  602.     }
  603.     public function __wakeup(): void
  604.     {
  605.         $this->security null;
  606.     }
  607.     public function getArticle(): ?string
  608.     {
  609.         return $this->article;
  610.     }
  611.     public function setArticle(?string $article): self
  612.     {
  613.         $this->article $article;
  614.         return $this;
  615.     }
  616.     public function getNds(): ?float
  617.     {
  618.         return $this->nds;
  619.     }
  620.     public function setNds(?float $nds): self
  621.     {
  622.         $this->nds $nds;
  623.         return $this;
  624.     }
  625.     public function isService(): ?bool
  626.     {
  627.         return $this->service;
  628.     }
  629.     public function setService(?bool $service): self
  630.     {
  631.         $this->service $service;
  632.         return $this;
  633.     }
  634.     public function isTransportService(): ?bool
  635.     {
  636.         return $this->transport_service;
  637.     }
  638.     public function setTransportService(?bool $transport_service): self
  639.     {
  640.         $this->transport_service $transport_service;
  641.         return $this;
  642.     }
  643.     public function isExise(): ?bool
  644.     {
  645.         return $this->exise;
  646.     }
  647.     public function setExise(bool $exise): self
  648.     {
  649.         $this->exise $exise;
  650.         return $this;
  651.     }
  652.     public function isExpirationDate(): ?bool
  653.     {
  654.         return $this->expiration_date;
  655.     }
  656.     public function setExpirationDate(?bool $expiration_date): self
  657.     {
  658.         $this->expiration_date $expiration_date;
  659.         return $this;
  660.     }
  661.     public function getUnitVolume(): ?float
  662.     {
  663.         return $this->unit_volume;
  664.     }
  665.     public function setUnitVolume(?float $unit_volume): self
  666.     {
  667.         $this->unit_volume $unit_volume;
  668.         return $this;
  669.     }
  670.     public function getNetWeight(): ?float
  671.     {
  672.         return $this->net_weight;
  673.     }
  674.     public function setNetWeight(?float $net_weight): self
  675.     {
  676.         $this->net_weight $net_weight;
  677.         return $this;
  678.     }
  679.     public function getGrossWeight(): ?float
  680.     {
  681.         return $this->gross_weight;
  682.     }
  683.     public function setGrossWeight(?float $gross_weight): self
  684.     {
  685.         $this->gross_weight $gross_weight;
  686.         return $this;
  687.     }
  688.     public function isGoByWeight(): ?bool
  689.     {
  690.         return $this->go_by_weight;
  691.     }
  692.     public function setGoByWeight(?bool $go_by_weight): self
  693.     {
  694.         $this->go_by_weight $go_by_weight;
  695.         return $this;
  696.     }
  697.     public function getPackaging(): ?float
  698.     {
  699.         return $this->packaging;
  700.     }
  701.     public function setPackaging(?float $packaging): self
  702.     {
  703.         $this->packaging $packaging;
  704.         return $this;
  705.     }
  706.     public function getSiteProduct(): ?SiteProducts
  707.     {
  708.         return $this->siteProduct;
  709.     }
  710.     public function setSiteProduct(?SiteProducts $siteProduct): self
  711.     {
  712.         $this->siteProduct $siteProduct;
  713.         return $this;
  714.     }
  715.     /**
  716.      * @return Collection<int, Category>
  717.      */
  718.     public function getCategory(): Collection
  719.     {
  720.         return $this->category;
  721.     }
  722.     public function addCategory(Category $category): self
  723.     {
  724.         if (!$this->category->contains($category)) {
  725.             $this->category->add($category);
  726.         }
  727.         return $this;
  728.     }
  729.     public function removeCategory(Category $category): self
  730.     {
  731.         $this->category->removeElement($category);
  732.         return $this;
  733.     }
  734.     /**
  735.      * @return Collection<int, MediaObject>
  736.      */
  737.     public function getMediaObjects(): Collection
  738.     {
  739.         return $this->mediaObjects;
  740.     }
  741.     public function addMediaObject(MediaObject $mediaObject): self
  742.     {
  743.         if (!$this->mediaObjects->contains($mediaObject)) {
  744.             $this->mediaObjects->add($mediaObject);
  745.             $mediaObject->setProduct($this);
  746.         }
  747.         return $this;
  748.     }
  749.     public function removeMediaObject(MediaObject $mediaObject): self
  750.     {
  751.         if ($this->mediaObjects->removeElement($mediaObject)) {
  752.             // set the owning side to null (unless already changed)
  753.             if ($mediaObject->getProduct() === $this) {
  754.                 $mediaObject->setProduct(null);
  755.             }
  756.         }
  757.         return $this;
  758.     }
  759.     public function getOldCode(): ?string
  760.     {
  761.         return $this->oldCode;
  762.     }
  763.     public function setOldCode(string $oldCode): self
  764.     {
  765.         $this->oldCode $oldCode;
  766.         return $this;
  767.     }
  768.     /**
  769.      * @return Collection<int, UserLikeList>
  770.      */
  771.     public function getUserLikeLists(): Collection
  772.     {
  773.         return $this->userLikeLists;
  774.     }
  775.     public function addUserLikeList(UserLikeList $userLikeList): self
  776.     {
  777.         if (!$this->userLikeLists->contains($userLikeList)) {
  778.             $this->userLikeLists->add($userLikeList);
  779.             $userLikeList->setз�product($this);
  780.         }
  781.         return $this;
  782.     }
  783.     public function removeUserLikeList(UserLikeList $userLikeList): self
  784.     {
  785.         if ($this->userLikeLists->removeElement($userLikeList)) {
  786.             // set the owning side to null (unless already changed)
  787.             if ($userLikeList->getз�product() === $this) {
  788.                 $userLikeList->setз�product(null);
  789.             }
  790.         }
  791.         return $this;
  792.     }
  793.     /**
  794.      * @return Collection<int, AttributeItems>
  795.      */
  796.     public function getAttributeItems(): Collection
  797.     {
  798.         return $this->attributeItems;
  799.     }
  800.     public function addAttributeItem(AttributeItems $attributeItem): self
  801.     {
  802.         if (!$this->attributeItems->contains($attributeItem)) {
  803.             $this->attributeItems->add($attributeItem);
  804.             $attributeItem->addProduct($this);
  805.         }
  806.         return $this;
  807.     }
  808.     public function removeAttributeItem(AttributeItems $attributeItem): self
  809.     {
  810.         if ($this->attributeItems->removeElement($attributeItem)) {
  811.             $attributeItem->removeProduct($this);
  812.         }
  813.         return $this;
  814.     }
  815.     public function isShow(): ?bool
  816.     {
  817.         return $this->show;
  818.     }
  819.     public function setShow(?bool $show): self
  820.     {
  821.         $this->show $show;
  822.         return $this;
  823.     }
  824.     public function getStorage(): ?Storage
  825.     {
  826.         return $this->storage;
  827.     }
  828.     public function setStorage(?Storage $storage): self
  829.     {
  830.         $this->storage $storage;
  831.         return $this;
  832.     }
  833.     public function getStorageElement(): ?StorageElement
  834.     {
  835.         return $this->storageElement;
  836.     }
  837.     public function setStorageElement(?StorageElement $storageElement): self
  838.     {
  839.         $this->storageElement $storageElement;
  840.         return $this;
  841.     }
  842.     
  843.     /**
  844.      * @return Collection<int, Prices>
  845.      */
  846.     public function getPrices(): Collection
  847.     {
  848.         return $this->prices;
  849.     }
  850.     public function addPrice(Prices $price): static
  851.     {
  852.         if (!$this->prices->contains($price)) {
  853.             $this->prices->add($price);
  854.             $price->setAgreement($this);
  855.         }
  856.         return $this;
  857.     }
  858.     public function removePrice(Prices $price): static
  859.     {
  860.         if ($this->prices->removeElement($price)) {
  861.             // set the owning side to null (unless already changed)
  862.             if ($price->getAgreement() === $this) {
  863.                 $price->setAgreement(null);
  864.             }
  865.         }
  866.         return $this;
  867.     }
  868.     /**
  869.      * @return Collection<int, ProductBalanceInStorage>
  870.      */
  871.     public function getProductBalanceInStorages(): Collection
  872.     {
  873.         return $this->productBalanceInStorages;
  874.     }
  875.     public function addProductBalanceInStorage(ProductBalanceInStorage $productBalanceInStorage): self
  876.     {
  877.         if (!$this->productBalanceInStorages->contains($productBalanceInStorage)) {
  878.             $this->productBalanceInStorages->add($productBalanceInStorage);
  879.             $productBalanceInStorage->setProduct($this);
  880.         }
  881.         return $this;
  882.     }
  883.     public function removeProductBalanceInStorage(ProductBalanceInStorage $productBalanceInStorage): self
  884.     {
  885.         if ($this->productBalanceInStorages->removeElement($productBalanceInStorage)) {
  886.             // set the owning side to null (unless already changed)
  887.             if ($productBalanceInStorage->getProduct() === $this) {
  888.                 $productBalanceInStorage->setProduct(null);
  889.             }
  890.         }
  891.         return $this;
  892.     }
  893.     public function getBalance(): ?float
  894.     {
  895.         return $this->balance;
  896.     }
  897.     public function setBalance(?float $balance): self
  898.     {
  899.         $this->balance $balance;
  900.         return $this;
  901.     }
  902.     /**
  903.      * @return Collection<int, OrderProduct>
  904.      */
  905.     public function getOrderProducts(): Collection
  906.     {
  907.         return $this->orderProducts;
  908.     }
  909.     public function addOrderProduct(OrderProduct $orderProduct): self
  910.     {
  911.         if (!$this->orderProducts->contains($orderProduct)) {
  912.             $this->orderProducts->add($orderProduct);
  913.             $orderProduct->setOrder($this);
  914.         }
  915.         return $this;
  916.     }
  917.     public function removeOrderProduct(OrderProduct $orderProduct): self
  918.     {
  919.         if ($this->orderProducts->removeElement($orderProduct)) {
  920.             // set the owning side to null (unless already changed)
  921.             if ($orderProduct->getOrder() === $this) {
  922.                 $orderProduct->setOrder(null);
  923.             }
  924.         }
  925.         return $this;
  926.     }
  927.     public function getLanguage(): ?Languages
  928.     {
  929.         return $this->language;
  930.     }
  931.     public function setLanguage(?Languages $language): self
  932.     {
  933.         $this->language $language;
  934.         return $this;
  935.     }
  936.     public function getTranslations(): ?self
  937.     {
  938.         return $this->translations;
  939.     }
  940.     public function setTranslations(?self $translations): self
  941.     {
  942.         $this->translations $translations;
  943.         return $this;
  944.     }
  945.     /**
  946.      * @return Collection<int, self>
  947.      */
  948.     public function getProducts(): Collection
  949.     {
  950.         return $this->products;
  951.     }
  952.     public function addProduct(self $product): self
  953.     {
  954.         if (!$this->products->contains($product)) {
  955.             $this->products->add($product);
  956.             $product->setTranslations($this);
  957.         }
  958.         return $this;
  959.     }
  960.     public function removeProduct(self $product): self
  961.     {
  962.         if ($this->products->removeElement($product)) {
  963.             // set the owning side to null (unless already changed)
  964.             if ($product->getTranslations() === $this) {
  965.                 $product->setTranslations(null);
  966.             }
  967.         }
  968.         return $this;
  969.     }
  970.     public function getMainMedia(): ?MediaObject
  971.     {
  972.         return $this->mainMedia;
  973.     }
  974.     public function setMainMedia(?MediaObject $mainMedia): self
  975.     {
  976.         $this->mainMedia $mainMedia;
  977.         return $this;
  978.     }
  979.     public function isDeleted(): ?bool
  980.     {
  981.         return $this->deleted;
  982.     }
  983.     public function setDeleted(?bool $deleted): static
  984.     {
  985.         $this->deleted $deleted;
  986.         return $this;
  987.     }
  988.     public function getCategoryCnt(): ?int
  989.     {
  990.         return $this->categoryCnt;
  991.     }
  992.     public function setCategoryCnt(?int $categoryCnt): static
  993.     {
  994.         $this->categoryCnt $categoryCnt;
  995.         return $this;
  996.     }
  997.     public function getPriceCategory(): ?array
  998.     {
  999.         return $this->priceCategory;
  1000.     }
  1001.     public function setPriceCategory(?array $priceCategory): static
  1002.     {
  1003.         $this->priceCategory $priceCategory;
  1004.         return $this;
  1005.     }
  1006.     /**
  1007.      * @return Collection<int, Comments>
  1008.      */
  1009.     public function getComments(): Collection
  1010.     {
  1011.         return $this->comments;
  1012.     }
  1013.     public function addComment(Comments $comment): static
  1014.     {
  1015.         if (!$this->comments->contains($comment)) {
  1016.             $this->comments->add($comment);
  1017.             $comment->setProduct($this);
  1018.         }
  1019.         return $this;
  1020.     }
  1021.     public function removeComment(Comments $comment): static
  1022.     {
  1023.         if ($this->comments->removeElement($comment)) {
  1024.             // set the owning side to null (unless already changed)
  1025.             if ($comment->getProduct() === $this) {
  1026.                 $comment->setProduct(null);
  1027.             }
  1028.         }
  1029.         return $this;
  1030.     }
  1031.     public function isIsSalle(): ?bool
  1032.     {
  1033.         return $this->isSalle;
  1034.     }
  1035.     public function setIsSalle(?bool $isSalle): static
  1036.     {
  1037.         $this->isSalle $isSalle;
  1038.         return $this;
  1039.     }
  1040.     public function isIsNew(): ?bool
  1041.     {
  1042.         return $this->isNew;
  1043.     }
  1044.     public function setIsNew(?bool $isNew): static
  1045.     {
  1046.         $this->isNew $isNew;
  1047.         return $this;
  1048.     }
  1049.     public function isIsTop(): ?bool
  1050.     {
  1051.         return $this->isTop;
  1052.     }
  1053.     public function setIsTop(?bool $isTop): static
  1054.     {
  1055.         $this->isTop $isTop;
  1056.         return $this;
  1057.     }
  1058.     public function getMainMediaHover(): ?MediaObject
  1059.     {
  1060.         return $this->mainMediaHover;
  1061.     }
  1062.     public function setMainMediaHover(?MediaObject $mainMediaHover): static
  1063.     {
  1064.         $this->mainMediaHover $mainMediaHover;
  1065.         return $this;
  1066.     }
  1067.     /**
  1068.      * @return Collection<int, ProductsReleted>
  1069.      */
  1070.     public function getProductsReleteds(): Collection
  1071.     {
  1072.         return $this->productsReleteds;
  1073.     }
  1074.     public function addProductsReleted(ProductsReleted $productsReleted): static
  1075.     {
  1076.         if (!$this->productsReleteds->contains($productsReleted)) {
  1077.             $this->productsReleteds->add($productsReleted);
  1078.             $productsReleted->setProduct($this);
  1079.         }
  1080.         return $this;
  1081.     }
  1082.     public function removeProductsReleted(ProductsReleted $productsReleted): static
  1083.     {
  1084.         if ($this->productsReleteds->removeElement($productsReleted)) {
  1085.             // set the owning side to null (unless already changed)
  1086.             if ($productsReleted->getProduct() === $this) {
  1087.                 $productsReleted->setProduct(null);
  1088.             }
  1089.         }
  1090.         return $this;
  1091.     }
  1092.     /**
  1093.      * @return Collection<int, ProductsReleted>
  1094.      */
  1095.     public function getParentProductRelateds(): Collection
  1096.     {
  1097.         return $this->parentProductRelateds;
  1098.     }
  1099.     public function addParentProductRelated(ProductsReleted $parentProductRelated): static
  1100.     {
  1101.         if (!$this->parentProductRelateds->contains($parentProductRelated)) {
  1102.             $this->parentProductRelateds->add($parentProductRelated);
  1103.             $parentProductRelated->setRelatedProduct($this);
  1104.         }
  1105.         return $this;
  1106.     }
  1107.     public function removeParentProductRelated(ProductsReleted $parentProductRelated): static
  1108.     {
  1109.         if ($this->parentProductRelateds->removeElement($parentProductRelated)) {
  1110.             // set the owning side to null (unless already changed)
  1111.             if ($parentProductRelated->getRelatedProduct() === $this) {
  1112.                 $parentProductRelated->setRelatedProduct(null);
  1113.             }
  1114.         }
  1115.         return $this;
  1116.     }
  1117.     public function getOldPrice(): ?float
  1118.     {
  1119.         return $this->oldPrice;
  1120.     }
  1121.     public function setOldPrice(?float $oldPrice): static
  1122.     {
  1123.         $this->oldPrice $oldPrice;
  1124.         return $this;
  1125.     }
  1126.     public function getDiscountPercent(): ?int
  1127.     {
  1128.         return $this->discountPercent;
  1129.     }
  1130.     public function setDiscountPercent(?int $discountPercent): static
  1131.     {
  1132.         $this->discountPercent $discountPercent;
  1133.         return $this;
  1134.     }
  1135. }