src/Entity/Category.php line 49
<?phpnamespace App\Entity;use ApiPlatform\Metadata\ApiResource;use App\Repository\CategoryRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\DBAL\Types\Types;use Doctrine\ORM\Mapping as ORM;use ApiPlatform\Metadata\ApiFilter;use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;use Symfony\Component\Serializer\Annotation\Groups;use ApiPlatform\Core\Annotation\ApiProperty;use Symfony\Component\Serializer\Annotation\MaxDepth;use ApiPlatform\Serializer\Filter\GroupFilter;#[ORM\Entity(repositoryClass: CategoryRepository::class)]#[ApiResource(normalizationContext: ['groups' => ['cat:read']],denormalizationContext: ['groups' => ['cat:write']],order: ['sort' => 'ASC', 'name' => 'ASC'],paginationPartial: false)]#[ApiFilter(SearchFilter::class, properties: ['name' => 'ipartial','status' => 'exact','categories.status' => 'exact','parent' => 'exact','main' => 'exact','type' => 'exact','slug' => 'exact','products.show' => 'exact','products.id' => 'exact','attributes.id' => 'exact','faqs.id' => 'exact','news.id' => 'exact','pages.id' => 'exact','projects.id' => 'exact','siteProducts.id' => 'exact','objects.id' => 'exact','language' => 'exact','active' => 'exact','categories.status' => 'exact',])]#[ApiFilter(GroupFilter::class, arguments: ['parameterName' => 'g', 'overrideDefaultGroups' => true])]class Category{#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column]#[Groups(['cat:read', 'cat:write', 'prod:medium', 'attributes:read', 'attributes_items:read', 'coupon:read', 'read', 'write', 'news:read', 'news:write', 'site_product:read', 'product:read', 'objects:read', 'faq:read', 'projects:read'])]private ?int $id = null;#[Groups(['cat:read'])]#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]private ?\DateTimeInterface $date_entered = null;#[Groups(['cat:read'])]#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]private ?\DateTimeInterface $date_modified = null;#[ORM\Column(nullable: true)]private ?int $created_by = null;#[ORM\Column(nullable: true)]private ?int $modified_user_id = null;#[Groups(['cat:read', 'cat:write', 'prod:medium', 'attributes:read', 'attributes_items:read', 'coupon:read', 'read', 'write', 'news:read', 'news:write', 'site_product:read', 'product:read', 'objects:read' , 'faq:read' , 'projects:read' ])]#[ORM\Column(length: 255)]private ?string $name = null;#[Groups(['cat:parent', 'cat:write'])]#[ORM\ManyToOne(targetEntity: self::class, inversedBy: 'categories', cascade:['persist'])]private ?self $parent = null;#[Groups(['cat:categories', 'cat:write'])]#[ORM\OneToMany(mappedBy: 'parent', targetEntity: self::class, cascade:['persist', 'remove'])]#[MaxDepth(1)]#[ApiProperty(writable: true)]private Collection $categories;#[Groups(['cat:read', 'cat:write', 'attributes:read', 'read', 'write', 'news:read', 'news:write', 'site_product:read', 'product:read', 'faq:read', 'projects:read'])]#[ORM\Column(length: 100, nullable: true)]private ?string $slug = null;#[Groups(['cat:read', 'cat:write', 'read', 'write', 'news:read', 'news:write', 'site_product:read'])]#[ORM\Column(length: 100, nullable: true)]private ?string $status = null;#[Groups(['cat:read', 'cat:write', 'read', 'write','news:read', 'news:write', 'site_product:read'])]#[ORM\Column(type: Types::TEXT, nullable: true)]private ?string $description = null;#[Groups(['cat:read', 'cat:write', 'read', 'write', 'news:read', 'news:write', 'site_product:read'])]#[ORM\Column(nullable: true)]private ?bool $main = null;#[Groups(['cat:read', 'cat:write', 'read', 'write', 'news:read', 'news:write', 'site_product:read', 'product:read', 'faq:read'])]#[ORM\Column(length: 20, nullable: true)]private ?string $type = null;#[ApiProperty(writable: true)]#[Groups(['cat:products', 'cat:write'])]#[ORM\ManyToMany(targetEntity: Products::class, mappedBy: 'category', cascade:['persist'])]#[MaxDepth(1)]private Collection $products;#[Groups(['cat:attributes', 'cat:write'])]#[ORM\ManyToMany(targetEntity: Attributes::class, mappedBy: 'category', cascade:['persist'])]private Collection $attributes;#[ORM\ManyToMany(targetEntity: AttributeItems::class, mappedBy: 'categories', cascade:['persist'])]private Collection $attributeItems;#[ORM\ManyToMany(targetEntity: Coupons::class, mappedBy: 'category', cascade:['persist'])]private Collection $coupons;#[ORM\ManyToMany(targetEntity: Faq::class, mappedBy: 'category')]private Collection $faqs;#[Groups(['cat:pages', 'cat:write'])]#[ORM\ManyToMany(targetEntity: Pages::class, mappedBy: 'categories', cascade:['persist'])]private Collection $pages;#[Groups(['cat:news', 'cat:write'])]#[ORM\ManyToMany(targetEntity: News::class, inversedBy: 'categories', cascade:['persist'])]private Collection $news;#[Groups(['cat:siteProducts', 'cat:write'])]#[ORM\ManyToMany(targetEntity: SiteProducts::class, mappedBy: 'category')]private Collection $siteProducts;#[Groups(['cat:read', 'cat:write'])]#[ORM\Column(nullable: true, options: ["default" => 0])]private ?int $productCnt = null;#[Groups(['cat:read', 'cat:write'])]#[ORM\Column(nullable: true, options: ["default" => 0])]private ?int $SiteProductCnt = null;#[Groups(['cat:media', 'cat:write'])]#[ORM\ManyToOne(inversedBy: 'categories')]private ?MediaObject $media = null;#[Groups(['cat:read', 'cat:write', 'read', 'write', 'news:read', 'news:write', 'site_product:read'])]#[ORM\Column(nullable: true)]private ?int $sort = null;#[Groups(['cat:objects', 'cat:write'])]#[ORM\ManyToMany(targetEntity: Objects::class, mappedBy: 'category')]private Collection $objects;#[Groups(['cat:projects', 'cat:write'])]#[ORM\ManyToMany(targetEntity: Projects::class, mappedBy: 'category')]private Collection $projects;#[Groups(['cat:read', 'cat:write'])]#[ORM\ManyToOne(inversedBy: 'categories')]private ?Languages $language = null;#[Groups(['cat:read', 'cat:write'])]#[ORM\ManyToOne(targetEntity: self::class, inversedBy: 'translations')]private ?self $translation = null;#[Groups(['cat:read', 'cat:write', ])]#[ORM\OneToMany(mappedBy: 'translation', targetEntity: self::class)]private Collection $translations;#[Groups(['cat:read', 'cat:write'])]#[ORM\Column(length: 255, nullable: true)]private ?string $seoTitle = null;#[Groups(['cat:read', 'cat:write'])]#[ORM\Column(type: Types::TEXT, nullable: true)]private ?string $seoDescription = null;public function __construct(){$this->categories = new ArrayCollection();$this->products = new ArrayCollection();$this->attributes = new ArrayCollection();$this->attributeItems = new ArrayCollection();$this->coupons = new ArrayCollection();$this->faqs = new ArrayCollection();$this->pages = new ArrayCollection();$this->news = new ArrayCollection();$this->siteProducts = new ArrayCollection();$this->objects = new ArrayCollection();$this->projects = new ArrayCollection();$this->translations = new ArrayCollection();}public function getId(): ?int{return $this->id;}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 getCreatedBy(): ?int{return $this->created_by;}public function setCreatedBy(?int $created_by): self{$this->created_by = $created_by;return $this;}public function getModifiedUserId(): ?int{return $this->modified_user_id;}public function setModifiedUserId(?int $modified_user_id): self{$this->modified_user_id = $modified_user_id;return $this;}public function getName(): ?string{return $this->name;}public function setName(string $name): self{$this->name = $name;return $this;}public function getParent(): ?self{return $this->parent;}public function setParent(?self $parent): self{$this->parent = $parent;return $this;}/*** @return Collection<int, self>*/public function getCategories(): Collection{return $this->categories;}public function addCategory(self $category): self{if (!$this->categories->contains($category)) {$this->categories->add($category);$category->setParent($this);}return $this;}public function removeCategory(self $category): self{if ($this->categories->removeElement($category)) {// set the owning side to null (unless already changed)if ($category->getParent() === $this) {$category->setParent(null);}}return $this;}public function getSlug(): ?string{return $this->slug;}public function setSlug(?string $slug): self{$this->slug = mb_strtolower( $slug );return $this;}public function getStatus(): ?string{return $this->status;}public function setStatus(?string $status): self{$this->status = $status;return $this;}public function getDescription(): ?string{return $this->description;}public function setDescription(?string $description): self{$this->description = $description;return $this;}public function isMain(): ?bool{return $this->main;}public function setMain(?bool $main): self{$this->main = $main;return $this;}public function getType(): ?string{return $this->type;}public function setType(?string $type): self{$this->type = $type;return $this;}/*** @return Collection<int, Products>*/public function getProducts(): Collection{return $this->products;}public function addProduct(Products $product): self{if (!$this->products->contains($product)) {$this->products->add($product);$product->addCategory($this);}return $this;}public function removeProduct(Products $product): self{if ($this->products->removeElement($product)) {$product->removeCategory($this);}return $this;}/*** @return Collection<int, Attributes>*/public function getAttributes(): Collection{return $this->attributes;}public function addAttribute(Attributes $attribute): self{if (!$this->attributes->contains($attribute)) {$this->attributes->add($attribute);$attribute->addCategory($this);}return $this;}public function removeAttribute(Attributes $attribute): self{if ($this->attributes->removeElement($attribute)) {$attribute->removeCategory($this);}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->addCategory($this);}return $this;}public function removeAttributeItem(AttributeItems $attributeItem): self{if ($this->attributeItems->removeElement($attributeItem)) {$attributeItem->removeCategory($this);}return $this;}/*** @return Collection<int, Coupons>*/public function getCoupons(): Collection{return $this->coupons;}public function addCoupon(Coupons $coupon): self{if (!$this->coupons->contains($coupon)) {$this->coupons->add($coupon);$coupon->addCategory($this);}return $this;}public function removeCoupon(Coupons $coupon): self{if ($this->coupons->removeElement($coupon)) {$coupon->removeCategory($this);}return $this;}/*** @return Collection<int, Faq>*/public function getFaqs(): Collection{return $this->faqs;}public function addFaq(Faq $faq): static{if (!$this->faqs->contains($faq)) {$this->faqs->add($faq);$faq->addCategory($this);}return $this;}/*** @return Collection<int, Pages>*/public function getPages(): Collection{return $this->pages;}public function addPage(Pages $page): static{if (!$this->pages->contains($page)) {$this->pages->add($page);}return $this;}public function removeFaq(Faq $faq): static{if ($this->faqs->removeElement($faq)) {$faq->removeCategory($this);}return $this;}public function removePage(Pages $page): static{$this->pages->removeElement($page);return $this;}/*** @return Collection<int, News>*/public function getNews(): Collection{return $this->news;}public function addNews(News $news): static{if (!$this->news->contains($news)) {$this->news->add($news);}return $this;}public function removeNews(News $news): static{$this->news->removeElement($news);return $this;}/*** @return Collection<int, SiteProducts>*/public function getSiteProducts(): Collection{return $this->siteProducts;}public function addSiteProduct(SiteProducts $siteProduct): static{if (!$this->siteProducts->contains($siteProduct)) {$this->siteProducts->add($siteProduct);$siteProduct->addCategory($this);}return $this;}public function getLanguage(): ?Languages{return $this->language;}public function setLanguage(?Languages $language): static{$this->language = $language;return $this;}public function removeSiteProduct(SiteProducts $siteProduct): static{if ($this->siteProducts->removeElement($siteProduct)) {$siteProduct->removeCategory($this);}return $this;}public function getProductCnt(): ?int{return $this->productCnt;}public function setProductCnt(?int $productCnt): static{$this->productCnt = $productCnt;return $this;}public function getSiteProductCnt(): ?int{return $this->SiteProductCnt;}public function setSiteProductCnt(?int $SiteProductCnt): static{$this->SiteProductCnt = $SiteProductCnt;return $this;}public function getMedia(): ?MediaObject{return $this->media;}public function setMedia(?MediaObject $media): static{$this->media = $media;return $this;}public function getSort(): ?int{return $this->sort;}public function setSort(?int $sort): static{$this->sort = $sort;return $this;}public function getTranslation(): ?self{return $this->translation;}public function setTranslation(?self $translation): static{$this->translation = $translation;return $this;}/*** @return Collection<int, Objects>*/public function getObjects(): Collection{return $this->objects;}public function addObject(Objects $object): static{if (!$this->objects->contains($object)) {$this->objects->add($object);$object->addCategory($this);}return $this;}/*** @return Collection<int, self>*/public function getTranslations(): Collection{return $this->translations;}public function addTranslation(self $translation): static{if (!$this->translations->contains($translation)) {$this->translations->add($translation);$translation->setTranslation($this);}return $this;}public function removeObject(Objects $object): static{if ($this->objects->removeElement($object)) {$object->removeCategory($this);}return $this;}/*** @return Collection<int, Projects>*/public function getProjects(): Collection{return $this->projects;}public function addProject(Projects $project): static{if (!$this->projects->contains($project)) {$this->projects->add($project);$project->addCategory($this);}return $this;}public function removeProject(Projects $project): static{if ($this->projects->removeElement($project)) {$project->removeCategory($this);}return $this;}public function removeTranslation(self $translation): static{if ($this->translations->removeElement($translation)) {// set the owning side to null (unless already changed)if ($translation->getTranslation() === $this) {$translation->setTranslation(null);}}return $this;}public function getSeoTitle(): ?string{return $this->seoTitle;}public function setSeoTitle(?string $seoTitle): static{$this->seoTitle = $seoTitle;return $this;}public function getSeoDescription(): ?string{return $this->seoDescription;}public function setSeoDescription(?string $seoDescription): static{$this->seoDescription = $seoDescription;return $this;}}