<?php
namespace App\Entity;
use ApiPlatform\Metadata\ApiResource;
use App\Repository\ProductsRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Security\Core\Security;
use Symfony\Component\Security\Core\SecurityInterface;
use DateTimeImmutable;
use ApiPlatform\Metadata\ApiFilter;
use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\BooleanFilter;
use ApiPlatform\Metadata\Get;
use ApiPlatform\Metadata\GetCollection;
use ApiPlatform\Metadata\Delete;
use ApiPlatform\Metadata\Put;
use ApiPlatform\Metadata\Post;
use App\Controller\BatchCreateProductAction;
use App\Controller\ProductController;
use Symfony\Component\Serializer\Annotation\Groups;
use ApiPlatform\Core\Annotation\ApiProperty;
use Symfony\Component\Serializer\Annotation\MaxDepth;
use App\Filter\ShowProductsFilter;
use ApiPlatform\Doctrine\Orm\Filter\OrderFilter;
use ApiPlatform\Doctrine\Orm\Filter\RangeFilter;
use App\Filter\CustomOrFilter;
use App\Filter\AttributeFilter;
use App\Filter\DeletedFilter;
use Doctrine\ORM\Mapping\Index;
use ApiPlatform\Serializer\Filter\GroupFilter;
use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\ExistsFilter;
#[ORM\Entity(repositoryClass: ProductsRepository::class)]
#[ApiResource(
operations: [
new Get(),
new Post(),
new Delete(),
new GetCollection(),
new Put(),
new Post(
name: 'batch',
uriTemplate: '/products/batch',
controller: BatchCreateProductAction::class
),
new Get(
name: 'filter_product',
uriTemplate: '/products/filter',
controller: ProductController::class
)
],
normalizationContext: ['groups' => ['product:read', 'prod:medium']],
denormalizationContext: ['groups' => ['product:write']],
order: ['name' => 'ASC'],
// paginationPartial: true,
paginationEnabled: true,
// filters: [ShowProductsFilter::class]
)]
// #[Get]
#[ORM\HasLifecycleCallbacks]
#[ApiFilter(RangeFilter::class, properties: ['balance', 'price'])]
#[ApiFilter(DeletedFilter::class)]
#[ApiFilter(
SearchFilter::class,
properties: [
'id' => 'exact',
'oldCode' => 'exact',
'code1c' => 'exact',
'top' => 'exact',
'productToOrder' => 'exact',
'name' => 'ipartial',
'barcode' => 'exact',
'category.id' => 'exact',
// 'attributeItems.id' => 'exact',
'show' => 'exact',
'article' => 'exact',
'prices.product' => 'exact',
'prices.agreement.virtual' => 'exact',
'prices.agreement.account.id' => 'exact',
'productBalanceInStorages.manager.id' => 'exact',
'orderProducts.order.account.id' => 'exact',
'orderProducts.order.account.user.id' => 'exact',
'categoryCnt' => 'exact',
'deleted' => 'exact',
],
)]
#[ApiFilter(AttributeFilter::class)]
#[ApiFilter(OrderFilter::class, properties: ['price', 'name'], arguments: ['orderParameterName' => 'order'])]
#[Index(name: "show", columns: ["show", "deleted"])]
#[ApiFilter(GroupFilter::class, arguments: ['parameterName' => 'g', 'overrideDefaultGroups' => true])]
#[ApiFilter(ExistsFilter::class, properties: ['attributeItems'])]
class Products
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
#[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'])]
private ?int $id = null;
#[ORM\Column(length: 255)]
#[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'])]
private ?string $name = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
#[Groups(['product:admin'])]
private ?\DateTimeInterface $date_entered;
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
#[Groups(['product:admin'])]
private ?\DateTimeInterface $date_modified;
#[ORM\ManyToOne(inversedBy: 'products')]
#[Groups(['product:modified_user'])]
#[MaxDepth(1)]
private ?User $modified_user = null;
#[ORM\ManyToOne(inversedBy: 'create_products')]
#[Groups(['product:created_by'])]
#[MaxDepth(1)]
private ?User $created_by;
#[Groups(['product:read', 'product:write', 'site_product:read'])]
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $description = null;
#[ORM\Column(length: 20, nullable: true)]
#[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'])]
private ?string $code1c = null;
#[ORM\Column(length: 100, nullable: true)]
#[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'])]
private ?string $barcode = null;
#[ORM\Column(length: 100, nullable: true)]
#[Groups(['product:read', 'product:write'])]
private ?string $status = null;
#[ORM\Column(nullable: true)]
#[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'])]
private ?float $price = null;
#[ORM\Column(nullable: true)]
#[Groups([ 'product:admin', 'product:write', 'order_product:read', 'product_releted:read'])]
private ?float $priceIncome = null;
#[ORM\Column(nullable: true)]
#[Groups(['product:admin', 'product:write'])]
private ?float $mark_up = null;
#[ORM\Column]
#[Groups(['product:admin', 'product:write'])]
private ?float $min_mark_up = 1;
#[ORM\Column(length: 100, nullable: true)]
#[Groups(['product:write'])]
private ?string $packing_type = null;
#[ORM\Column(nullable: true)]
#[Groups(['product:write'])]
private ?float $packing_type_count = null;
#[ORM\Column(nullable: true)]
#[Groups(['product:read', 'product:write', 'order_product:read', 'product_releted:read'])]
private ?int $discounts = null;
#[ORM\Column(nullable: true)]
#[Groups(['product:admin', 'product:write'])]
private ?int $count_order = null;
#[ORM\Column(nullable: true)]
#[Groups(['product:read', 'product:write'])]
private ?int $productToOrder = null;
#[ORM\ManyToOne]
#[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'])]
#[ApiProperty(writable: true)]
#[MaxDepth(1)]
private ?MeasurmentUnit $measurement_unit = null;
#[Groups(['product:productInfos', 'product:write', 'site_product:read'])]
#[MaxDepth(1)]
#[ORM\OneToMany(mappedBy: 'product', targetEntity: ProductInfo::class,)]
private ?Collection $productInfos = null;
#[MaxDepth(1)]
#[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'])]
#[ORM\OneToMany(mappedBy: 'product', targetEntity: MediaObject::class)]
private Collection $media;
#[MaxDepth(2)]
#[Groups(['product:incomingInvoiceProducts', 'product:write'])]
#[ORM\OneToMany(mappedBy: 'product', targetEntity: IncomingInvoiceProduct::class)]
private Collection $incomingInvoiceProducts;
private ?SecurityInterface $security = null;
#[ORM\Column(length: 20, nullable: true)]
#[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'])]
private ?string $article = null;
#[ORM\Column(nullable: true)]
#[Groups(['product:admin', 'product:write'])]
private ?float $nds = null;
#[ORM\Column(nullable: true)]
#[Groups(['product:admin', 'product:write'])]
private ?bool $service = null;
#[ORM\Column(nullable: true)]
#[Groups(['product:admin', 'product:write'])]
private ?bool $transport_service = null;
#[ORM\Column(nullable: true)]
#[Groups(['product:read', 'product:write'])]
private ?bool $exise = false;
#[ORM\Column(nullable: true)]
#[Groups(['product:read', 'product:write'])]
private ?bool $expiration_date = null;
#[ORM\Column(nullable: true)]
#[Groups(['product:read', 'product:write'])]
private ?float $unit_volume = null;
#[ORM\Column(nullable: true)]
#[Groups(['product:read', 'product:write'])]
private ?float $net_weight = null;
#[ORM\Column(nullable: true)]
#[Groups(['product:read', 'product:write'])]
private ?float $gross_weight = null;
#[ORM\Column(nullable: true)]
#[Groups(['product:read', 'product:write'])]
private ?bool $go_by_weight = null;
#[ORM\Column(nullable: true)]
#[Groups(['product:read', 'product:write'])]
private ?float $packaging = null;
#[ORM\ManyToOne(inversedBy: 'products')]
#[MaxDepth(1)]
#[Groups(['product:siteProduct', 'product:write'])]
private ?SiteProducts $siteProduct = null;
#[Groups([ 'product:category', 'product:write', 'attributes:read'])]
#[ORM\ManyToMany(targetEntity: Category::class, inversedBy: 'products')]
#[MaxDepth(1)]
private Collection $category;
#[Groups(['product:admin', 'product:write'])]
#[ORM\Column(length: 100, nullable: true)]
private ?string $oldCode = null;
#[ORM\OneToMany(mappedBy: 'product', targetEntity: UserLikeList::class)]
private Collection $userLikeLists;
#[Groups(['product:attributeItems', 'product:write', 'site_product:read'])]
#[ORM\ManyToMany(targetEntity: AttributeItems::class, mappedBy: 'product')]
private Collection $attributeItems;
#[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'])]
#[ORM\Column(nullable: true)]
private ?bool $show = null;
#[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'])]
#[ORM\ManyToOne(inversedBy: 'products')]
private ?Storage $storage = null;
#[MaxDepth(2)]
#[Groups(['product:storageElement', 'product:write','order:read', 'order_product:read'])]
#[ORM\ManyToOne(inversedBy: 'products')]
private ?StorageElement $storageElement = null;
#[ORM\OneToMany(mappedBy: 'product', targetEntity: Prices::class)]
private Collection $prices;
#[Groups(['product:productBalanceInStorages', 'product:write', 'order_product:read', 'pre_order_product:read'])]
#[ORM\OneToMany(mappedBy: 'product', targetEntity: ProductBalanceInStorage::class)]
private Collection $productBalanceInStorages;
#[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'])]
#[ORM\Column(nullable: true)]
private ?float $balance = null;
#[ApiProperty(writable: true)]
#[ORM\OneToMany(mappedBy: 'product', targetEntity: OrderProduct::class)]
private Collection $orderProducts;
#[Groups(['product:language', 'product:write'])]
#[ORM\ManyToOne(inversedBy: 'products')]
private ?Languages $language = null;
#[Groups(['product:language', 'product:write'])]
#[ORM\ManyToOne(targetEntity: self::class, inversedBy: 'products')]
private ?self $translations = null;
#[ORM\OneToMany(mappedBy: 'translations', targetEntity: self::class)]
private Collection $products;
#[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'])]
#[ORM\ManyToOne(inversedBy: 'MainProducts')]
private ?MediaObject $mainMedia = null;
#[Groups(['product:admin', 'product:write'])]
#[ORM\Column(nullable: true, options: ["default" => false])]
private ?bool $deleted = false;
#[Groups(['product:admin', 'product:write'])]
#[ORM\Column(nullable: true, options: ["default" => 0])]
private ?int $categoryCnt = 0;
#[Groups(['product:read', 'product:write', 'pre_order_product:read', 'pre_order:read', 'order:read', 'order_product:read', 'site_product:read'])]
#[ORM\Column(nullable: true)]
private ?array $priceCategory = null;
#[Groups(['product:comments', 'product:write'])]
#[ORM\OneToMany(mappedBy: 'product', targetEntity: Comments::class)]
private Collection $comments;
#[Groups(['product:read', 'product:write'])]
#[ORM\Column(nullable: true)]
private ?bool $isSalle = null;
#[Groups(['product:read', 'product:write'])]
#[ORM\Column(nullable: true)]
private ?bool $isNew = null;
#[Groups(['product:read', 'product:write'])]
#[ORM\Column(nullable: true)]
private ?bool $isTop = null;
#[Groups(['product:hover', 'product:write'])]
#[ORM\ManyToOne(inversedBy: 'productsHover')]
private ?MediaObject $mainMediaHover = null;
#[Groups(['productsReleteds:read', 'product:write'])]
#[ORM\OneToMany(mappedBy: 'product', targetEntity: ProductsReleted::class)]
private Collection $productsReleteds;
#[ORM\OneToMany(mappedBy: 'relatedProduct', targetEntity: ProductsReleted::class)]
private Collection $parentProductRelateds;
#[Groups(['product:read', 'product:write', 'product_releted:read'])]
#[ORM\Column(nullable: true)]
private ?float $oldPrice = null;
#[Groups(['product:read', 'product:write', 'product_releted:read'])]
#[ORM\Column(nullable: true)]
private ?int $discountPercent = null;
public function __construct() {
$this->productInfos = new ArrayCollection();
$this->media = new ArrayCollection();
$this->incomingInvoiceProducts = new ArrayCollection();
$this->category = new ArrayCollection();
// $this->mediaObjects = new ArrayCollection();
$this->userLikeLists = new ArrayCollection();
$this->attributeItems = new ArrayCollection();
$this->prices = new ArrayCollection();
$this->productBalanceInStorages = new ArrayCollection();
$this->orderProducts = new ArrayCollection();
$this->products = new ArrayCollection();
$this->comments = new ArrayCollection();
$this->productsReleteds = new ArrayCollection();
$this->parentProductRelateds = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function setId(string $id): self
{
$this->id = $id;
return $this;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getDateEntered(): ?\DateTimeInterface
{
return $this->date_entered;
}
// public function setDateEntered(?\DateTimeInterface $date_entered): self
// {
// $this->date_entered = $date_entered;
// return $this;
// }
public function getDateModified(): ?\DateTimeInterface
{
return $this->date_modified;
}
// public function setDateModified(?\DateTimeInterface $date_modified): self
// {
// $this->date_modified = $date_modified;
// return $this;
// }
public function getModifiedUser(): ?User
{
return $this->modified_user;
}
// public function setModifiedUserId(?User $modified_user_id): self
// {
// $this->modified_user_id = $modified_user_id;
// return $this;
// }
public function getCreatedBy(): ?User
{
return $this->created_by;
}
public function setCreatedBy(?User $created_by): self
{
$this->created_by = $created_by;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getCode1c(): ?string
{
return $this->code1c;
}
public function setCode1c(?string $code1c): self
{
$this->code1c = $code1c;
return $this;
}
public function getBarcode(): ?string
{
return $this->barcode;
}
public function setBarcode(?string $barcode): self
{
$this->barcode = $barcode;
return $this;
}
public function getStatus(): ?string
{
return $this->status;
}
public function setStatus(?string $status): self
{
$this->status = $status;
return $this;
}
public function getPrice(): ?float
{
return $this->price;
}
public function setPrice(?float $price): self
{
$this->price = $price;
return $this;
}
public function getPriceIncome(): ?float
{
return $this->priceIncome;
}
public function setPriceIncome(?float $priceIncome): self
{
$this->priceIncome = $priceIncome;
return $this;
}
public function getMarkUp(): ?float
{
return $this->mark_up;
}
public function setMarkUp(?float $mark_up): self
{
$this->mark_up = $mark_up;
return $this;
}
public function getMinMarkUp(): ?float
{
return $this->min_mark_up;
}
public function setMinMarkUp(float $min_mark_up): self
{
$this->min_mark_up = $min_mark_up;
return $this;
}
public function getPackingType(): ?string
{
return $this->packing_type;
}
public function setPackingType(?string $packing_type): self
{
$this->packing_type = $packing_type;
return $this;
}
public function getPackingTypeCount(): ?float
{
return $this->packing_type_count;
}
public function setPackingTypeCount(?float $packing_type_count): self
{
$this->packing_type_count = $packing_type_count;
return $this;
}
public function getDiscounts(): ?int
{
return $this->discounts;
}
public function setDiscounts(?int $discounts): self
{
$this->discounts = $discounts;
return $this;
}
public function getCountOrder(): ?int
{
return $this->count_order;
}
public function setCountOrder(?int $count_order): self
{
$this->count_order = $count_order;
return $this;
}
public function getProductToOrder(): ?int
{
return $this->productToOrder;
}
public function setProductToOrder(?int $productToOrder): self
{
$this->productToOrder = $productToOrder;
return $this;
}
public function getMeasurementUnit(): ?MeasurmentUnit
{
return $this->measurement_unit;
}
public function setMeasurementUnit(?MeasurmentUnit $measurement_unit_id): self
{
$this->measurement_unit = $measurement_unit_id;
return $this;
}
/**
* @return Collection<int, ProductInfo>
*/
public function getProductInfos(): Collection
{
return $this->productInfos;
}
public function addProductInfo(ProductInfo $productInfo): self
{
if (!$this->productInfos->contains($productInfo)) {
$this->productInfos->add($productInfo);
$productInfo->setProduct($this);
}
return $this;
}
public function removeProductInfo(ProductInfo $productInfo): self
{
if ($this->productInfos->removeElement($productInfo)) {
// set the owning side to null (unless already changed)
if ($productInfo->getProduct() === $this) {
$productInfo->setProduct(null);
}
}
return $this;
}
/**
* @return Collection<int, MediaObject>
*/
public function getMedia(): Collection
{
return $this->media;
}
public function addMedium(MediaObject $medium): self
{
if (!$this->media->contains($medium)) {
$this->media->add($medium);
$medium->setProduct($this);
}
return $this;
}
public function removeMedium(MediaObject $medium): self
{
if ($this->media->removeElement($medium)) {
// set the owning side to null (unless already changed)
if ($medium->getProduct() === $this) {
$medium->setProduct(null);
}
}
return $this;
}
/**
* @return Collection<int, IncomingInvoiceProduct>
*/
public function getIncomingInvoiceProducts(): Collection
{
return $this->incomingInvoiceProducts;
}
public function addIncomingInvoiceProduct(IncomingInvoiceProduct $incomingInvoiceProduct): self
{
if (!$this->incomingInvoiceProducts->contains($incomingInvoiceProduct)) {
$this->incomingInvoiceProducts->add($incomingInvoiceProduct);
$incomingInvoiceProduct->setProduct($this);
}
return $this;
}
public function removeIncomingInvoiceProduct(IncomingInvoiceProduct $incomingInvoiceProduct): self
{
if ($this->incomingInvoiceProducts->removeElement($incomingInvoiceProduct)) {
// set the owning side to null (unless already changed)
if ($incomingInvoiceProduct->getProduct() === $this) {
$incomingInvoiceProduct->setProduct(null);
}
}
return $this;
}
#[ORM\PrePersist]
public function setCreatedAtValue(): void
{
$this->date_entered = new \DateTime();
file_put_contents('/var/www/symfony_docker/public/errorrrrrr.log', $this->getCurrentUserId() . "\n", FILE_APPEND);
$this->created_by = $this->getCurrentUserId();
}
// #[ORM\PrePersist]
#[ORM\PreUpdate]
public function setUpdatedAtValue(): void
{
file_put_contents('/var/www/symfony_docker/public/errorrrrrr.log', "222222\n", FILE_APPEND);
$this->date_modified = new \DateTime();
$this->modified_user = $this->getCurrentUserId();
}
public function getCurrentUserId(): ?User
{
file_put_contents('/var/www/symfony_docker/public/errorrrrrr.log', print_r($this->security, true)."\n", FILE_APPEND);
if (!$this->security) {
return null;
}
$token = $this->security->getToken();
if (!$token) {
return null;
}
$user = $token->getUser();
if (!$user instanceof User) {
return null;
}
return $user;
}
public function __sleep()
{
return [
'modified_user',
// 'created_by',
// 'date_entered',
'date_modified'
];
}
public function __wakeup(): void
{
$this->security = null;
}
public function getArticle(): ?string
{
return $this->article;
}
public function setArticle(?string $article): self
{
$this->article = $article;
return $this;
}
public function getNds(): ?float
{
return $this->nds;
}
public function setNds(?float $nds): self
{
$this->nds = $nds;
return $this;
}
public function isService(): ?bool
{
return $this->service;
}
public function setService(?bool $service): self
{
$this->service = $service;
return $this;
}
public function isTransportService(): ?bool
{
return $this->transport_service;
}
public function setTransportService(?bool $transport_service): self
{
$this->transport_service = $transport_service;
return $this;
}
public function isExise(): ?bool
{
return $this->exise;
}
public function setExise(bool $exise): self
{
$this->exise = $exise;
return $this;
}
public function isExpirationDate(): ?bool
{
return $this->expiration_date;
}
public function setExpirationDate(?bool $expiration_date): self
{
$this->expiration_date = $expiration_date;
return $this;
}
public function getUnitVolume(): ?float
{
return $this->unit_volume;
}
public function setUnitVolume(?float $unit_volume): self
{
$this->unit_volume = $unit_volume;
return $this;
}
public function getNetWeight(): ?float
{
return $this->net_weight;
}
public function setNetWeight(?float $net_weight): self
{
$this->net_weight = $net_weight;
return $this;
}
public function getGrossWeight(): ?float
{
return $this->gross_weight;
}
public function setGrossWeight(?float $gross_weight): self
{
$this->gross_weight = $gross_weight;
return $this;
}
public function isGoByWeight(): ?bool
{
return $this->go_by_weight;
}
public function setGoByWeight(?bool $go_by_weight): self
{
$this->go_by_weight = $go_by_weight;
return $this;
}
public function getPackaging(): ?float
{
return $this->packaging;
}
public function setPackaging(?float $packaging): self
{
$this->packaging = $packaging;
return $this;
}
public function getSiteProduct(): ?SiteProducts
{
return $this->siteProduct;
}
public function setSiteProduct(?SiteProducts $siteProduct): self
{
$this->siteProduct = $siteProduct;
return $this;
}
/**
* @return Collection<int, Category>
*/
public function getCategory(): Collection
{
return $this->category;
}
public function addCategory(Category $category): self
{
if (!$this->category->contains($category)) {
$this->category->add($category);
}
return $this;
}
public function removeCategory(Category $category): self
{
$this->category->removeElement($category);
return $this;
}
/**
* @return Collection<int, MediaObject>
*/
public function getMediaObjects(): Collection
{
return $this->mediaObjects;
}
public function addMediaObject(MediaObject $mediaObject): self
{
if (!$this->mediaObjects->contains($mediaObject)) {
$this->mediaObjects->add($mediaObject);
$mediaObject->setProduct($this);
}
return $this;
}
public function removeMediaObject(MediaObject $mediaObject): self
{
if ($this->mediaObjects->removeElement($mediaObject)) {
// set the owning side to null (unless already changed)
if ($mediaObject->getProduct() === $this) {
$mediaObject->setProduct(null);
}
}
return $this;
}
public function getOldCode(): ?string
{
return $this->oldCode;
}
public function setOldCode(string $oldCode): self
{
$this->oldCode = $oldCode;
return $this;
}
/**
* @return Collection<int, UserLikeList>
*/
public function getUserLikeLists(): Collection
{
return $this->userLikeLists;
}
public function addUserLikeList(UserLikeList $userLikeList): self
{
if (!$this->userLikeLists->contains($userLikeList)) {
$this->userLikeLists->add($userLikeList);
$userLikeList->setз�product($this);
}
return $this;
}
public function removeUserLikeList(UserLikeList $userLikeList): self
{
if ($this->userLikeLists->removeElement($userLikeList)) {
// set the owning side to null (unless already changed)
if ($userLikeList->getз�product() === $this) {
$userLikeList->setз�product(null);
}
}
return $this;
}
/**
* @return Collection<int, AttributeItems>
*/
public function getAttributeItems(): Collection
{
return $this->attributeItems;
}
public function addAttributeItem(AttributeItems $attributeItem): self
{
if (!$this->attributeItems->contains($attributeItem)) {
$this->attributeItems->add($attributeItem);
$attributeItem->addProduct($this);
}
return $this;
}
public function removeAttributeItem(AttributeItems $attributeItem): self
{
if ($this->attributeItems->removeElement($attributeItem)) {
$attributeItem->removeProduct($this);
}
return $this;
}
public function isShow(): ?bool
{
return $this->show;
}
public function setShow(?bool $show): self
{
$this->show = $show;
return $this;
}
public function getStorage(): ?Storage
{
return $this->storage;
}
public function setStorage(?Storage $storage): self
{
$this->storage = $storage;
return $this;
}
public function getStorageElement(): ?StorageElement
{
return $this->storageElement;
}
public function setStorageElement(?StorageElement $storageElement): self
{
$this->storageElement = $storageElement;
return $this;
}
/**
* @return Collection<int, Prices>
*/
public function getPrices(): Collection
{
return $this->prices;
}
public function addPrice(Prices $price): static
{
if (!$this->prices->contains($price)) {
$this->prices->add($price);
$price->setAgreement($this);
}
return $this;
}
public function removePrice(Prices $price): static
{
if ($this->prices->removeElement($price)) {
// set the owning side to null (unless already changed)
if ($price->getAgreement() === $this) {
$price->setAgreement(null);
}
}
return $this;
}
/**
* @return Collection<int, ProductBalanceInStorage>
*/
public function getProductBalanceInStorages(): Collection
{
return $this->productBalanceInStorages;
}
public function addProductBalanceInStorage(ProductBalanceInStorage $productBalanceInStorage): self
{
if (!$this->productBalanceInStorages->contains($productBalanceInStorage)) {
$this->productBalanceInStorages->add($productBalanceInStorage);
$productBalanceInStorage->setProduct($this);
}
return $this;
}
public function removeProductBalanceInStorage(ProductBalanceInStorage $productBalanceInStorage): self
{
if ($this->productBalanceInStorages->removeElement($productBalanceInStorage)) {
// set the owning side to null (unless already changed)
if ($productBalanceInStorage->getProduct() === $this) {
$productBalanceInStorage->setProduct(null);
}
}
return $this;
}
public function getBalance(): ?float
{
return $this->balance;
}
public function setBalance(?float $balance): self
{
$this->balance = $balance;
return $this;
}
/**
* @return Collection<int, OrderProduct>
*/
public function getOrderProducts(): Collection
{
return $this->orderProducts;
}
public function addOrderProduct(OrderProduct $orderProduct): self
{
if (!$this->orderProducts->contains($orderProduct)) {
$this->orderProducts->add($orderProduct);
$orderProduct->setOrder($this);
}
return $this;
}
public function removeOrderProduct(OrderProduct $orderProduct): self
{
if ($this->orderProducts->removeElement($orderProduct)) {
// set the owning side to null (unless already changed)
if ($orderProduct->getOrder() === $this) {
$orderProduct->setOrder(null);
}
}
return $this;
}
public function getLanguage(): ?Languages
{
return $this->language;
}
public function setLanguage(?Languages $language): self
{
$this->language = $language;
return $this;
}
public function getTranslations(): ?self
{
return $this->translations;
}
public function setTranslations(?self $translations): self
{
$this->translations = $translations;
return $this;
}
/**
* @return Collection<int, self>
*/
public function getProducts(): Collection
{
return $this->products;
}
public function addProduct(self $product): self
{
if (!$this->products->contains($product)) {
$this->products->add($product);
$product->setTranslations($this);
}
return $this;
}
public function removeProduct(self $product): self
{
if ($this->products->removeElement($product)) {
// set the owning side to null (unless already changed)
if ($product->getTranslations() === $this) {
$product->setTranslations(null);
}
}
return $this;
}
public function getMainMedia(): ?MediaObject
{
return $this->mainMedia;
}
public function setMainMedia(?MediaObject $mainMedia): self
{
$this->mainMedia = $mainMedia;
return $this;
}
public function isDeleted(): ?bool
{
return $this->deleted;
}
public function setDeleted(?bool $deleted): static
{
$this->deleted = $deleted;
return $this;
}
public function getCategoryCnt(): ?int
{
return $this->categoryCnt;
}
public function setCategoryCnt(?int $categoryCnt): static
{
$this->categoryCnt = $categoryCnt;
return $this;
}
public function getPriceCategory(): ?array
{
return $this->priceCategory;
}
public function setPriceCategory(?array $priceCategory): static
{
$this->priceCategory = $priceCategory;
return $this;
}
/**
* @return Collection<int, Comments>
*/
public function getComments(): Collection
{
return $this->comments;
}
public function addComment(Comments $comment): static
{
if (!$this->comments->contains($comment)) {
$this->comments->add($comment);
$comment->setProduct($this);
}
return $this;
}
public function removeComment(Comments $comment): static
{
if ($this->comments->removeElement($comment)) {
// set the owning side to null (unless already changed)
if ($comment->getProduct() === $this) {
$comment->setProduct(null);
}
}
return $this;
}
public function isIsSalle(): ?bool
{
return $this->isSalle;
}
public function setIsSalle(?bool $isSalle): static
{
$this->isSalle = $isSalle;
return $this;
}
public function isIsNew(): ?bool
{
return $this->isNew;
}
public function setIsNew(?bool $isNew): static
{
$this->isNew = $isNew;
return $this;
}
public function isIsTop(): ?bool
{
return $this->isTop;
}
public function setIsTop(?bool $isTop): static
{
$this->isTop = $isTop;
return $this;
}
public function getMainMediaHover(): ?MediaObject
{
return $this->mainMediaHover;
}
public function setMainMediaHover(?MediaObject $mainMediaHover): static
{
$this->mainMediaHover = $mainMediaHover;
return $this;
}
/**
* @return Collection<int, ProductsReleted>
*/
public function getProductsReleteds(): Collection
{
return $this->productsReleteds;
}
public function addProductsReleted(ProductsReleted $productsReleted): static
{
if (!$this->productsReleteds->contains($productsReleted)) {
$this->productsReleteds->add($productsReleted);
$productsReleted->setProduct($this);
}
return $this;
}
public function removeProductsReleted(ProductsReleted $productsReleted): static
{
if ($this->productsReleteds->removeElement($productsReleted)) {
// set the owning side to null (unless already changed)
if ($productsReleted->getProduct() === $this) {
$productsReleted->setProduct(null);
}
}
return $this;
}
/**
* @return Collection<int, ProductsReleted>
*/
public function getParentProductRelateds(): Collection
{
return $this->parentProductRelateds;
}
public function addParentProductRelated(ProductsReleted $parentProductRelated): static
{
if (!$this->parentProductRelateds->contains($parentProductRelated)) {
$this->parentProductRelateds->add($parentProductRelated);
$parentProductRelated->setRelatedProduct($this);
}
return $this;
}
public function removeParentProductRelated(ProductsReleted $parentProductRelated): static
{
if ($this->parentProductRelateds->removeElement($parentProductRelated)) {
// set the owning side to null (unless already changed)
if ($parentProductRelated->getRelatedProduct() === $this) {
$parentProductRelated->setRelatedProduct(null);
}
}
return $this;
}
public function getOldPrice(): ?float
{
return $this->oldPrice;
}
public function setOldPrice(?float $oldPrice): static
{
$this->oldPrice = $oldPrice;
return $this;
}
public function getDiscountPercent(): ?int
{
return $this->discountPercent;
}
public function setDiscountPercent(?int $discountPercent): static
{
$this->discountPercent = $discountPercent;
return $this;
}
}