src/Entity/Attributes.php line 24
<?phpnamespace App\Entity;use ApiPlatform\Metadata\ApiResource;use App\Repository\AttributesRepository;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;#[ORM\Entity(repositoryClass: AttributesRepository::class)]#[ApiResource(normalizationContext: ['groups' => ['attributes:read']],denormalizationContext: ['groups' => ['attributes:write']],order: ['sort' => 'ASC', 'name' => 'ASC', 'attributeItems.sort' => 'ASC', 'attributeItems.name' => 'ASC'],)]#[ApiFilter(SearchFilter::class, properties: ['name' => 'ipartial', 'category.id' => 'exact', 'language' => 'exact'])]class Attributes{#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column]#[Groups(['attributes:read', 'attributes:write', 'cat:read', 'product:read', 'attributes_items:read', 'site_product:read', 'objects:read'])]private ?int $id = null;#[ORM\Column(length: 255)]#[Groups(['attributes:read', 'attributes:write', 'cat:read', 'product:read', 'attributes_items:read', 'site_product:read', 'objects:read'])]private ?string $name = null;#[Groups(['attributes:read', 'attributes:write'])]#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]private ?\DateTimeInterface $date_entered = null;#[Groups(['attributes:read', 'attributes:write'])]#[ORM\ManyToMany(targetEntity: Category::class, inversedBy: 'attributes')]private Collection $category;#[Groups(['attributes:read', 'attributes:write', 'cat:read', 'product:read', 'site_product:read', 'objects:read', 'attributes_items:read'])]#[ORM\Column(length: 255)]private ?string $slug = null;#[Groups(['cat:read', 'attributes:read', 'attributes:write'])]#[ORM\OneToMany(mappedBy: 'attribute', targetEntity: AttributeItems::class, cascade:['persist', 'remove'])]private Collection $attributeItems;#[Groups(['attributes:read', 'attributes:write', 'cat:read', 'product:read', 'attributes_items:read', 'site_product:read'])]#[ORM\Column(nullable: true)]private ?int $sort = 0;#[Groups(['cat:read', 'attributes:read', 'attributes:write'])]#[ORM\Column(nullable: true)]private ?bool $show = null;#[Groups(['cat:read', 'attributes:read', 'attributes:write'])]#[ORM\Column(nullable: true)]private ?bool $filter = null;#[Groups(['attributes:read', 'attributes:write', 'product:read'])]#[ORM\ManyToOne(inversedBy: 'attributes')]private ?Languages $language = null;#[Groups(['attributes:read', 'attributes:write', 'product:read'])]#[ORM\ManyToOne(targetEntity: self::class, inversedBy: 'translations')]private ?self $translation = null;#[Groups(['attributes:read', 'attributes:write', 'product:read'])]#[ORM\OneToMany(mappedBy: 'translation', targetEntity: self::class)]private Collection $translations;public function __construct(){$this->category = new ArrayCollection();$this->attributeItems = new ArrayCollection();$this->translations = new ArrayCollection();}public function getId(): ?int{return $this->id;}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;}/*** @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;}public function getSlug(): ?string{return $this->slug;}public function setSlug(string $slug): self{$this->slug = $slug;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->setAttribute($this);}return $this;}public function removeAttributeItem(AttributeItems $attributeItem): self{if ($this->attributeItems->removeElement($attributeItem)) {// set the owning side to null (unless already changed)if ($attributeItem->getAttribute() === $this) {$attributeItem->setAttribute(null);}}return $this;}public function getSort(): ?int{return $this->sort;}public function setSort(int $sort): self{$this->sort = $sort;return $this;}public function getLanguage(): ?Languages{return $this->language;}public function setLanguage(?Languages $language): static{$this->language = $language;return $this;}public function isShow(): ?bool{return $this->show;}public function setShow(?bool $show): static{$this->show = $show;return $this;}public function getTranslation(): ?self{return $this->translation;}public function setTranslation(?self $translation): static{$this->translation = $translation;return $this;}public function isFilter(): ?bool{return $this->filter;}public function setFilter(?bool $filter): static{$this->filter = $filter;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 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;}}