<?php 
 
namespace App\Entity; 
 
use ApiPlatform\Metadata\ApiResource; 
use App\Repository\PagesRepository; 
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 ApiPlatform\Metadata\GetCollection; 
use ApiPlatform\Metadata\ApiProperty; 
use ApiPlatform\Metadata\Post; 
use ApiPlatform\Metadata\Get; 
use ApiPlatform\Metadata\Delete; 
use ApiPlatform\Metadata\Put; 
use Symfony\Component\HttpFoundation\File\File; 
use Symfony\Component\Serializer\Annotation\Groups; 
use Vich\UploaderBundle\Mapping\Annotation as Vich; 
use App\Api\Filter\OrFilter; 
use App\Filter\CustomOrFilter; 
 
 
 
 
 
#[ORM\Entity(repositoryClass: PagesRepository::class)] 
#[Get] 
#[Put(security: "is_granted('ROLE_ADMIN')")] 
#[Post(security: "is_granted('ROLE_ADMIN')")] 
#[Delete(security: "is_granted('ROLE_ADMIN')")] 
#[ApiResource( 
    normalizationContext: ['groups' => ['read']], 
    denormalizationContext: ['groups' => ['write']], 
    order: ['id' => 'DESC'] 
)] 
#[ApiFilter(CustomOrFilter::class,properties: [ 
    'name' => 'ipartial',  
    'content' => 'ipartial' 
])] 
#[ApiFilter(SearchFilter::class, properties: ['synonym' => 'exact', 'type' => 'exact'])] 
// #[ApiFilter(OrFilter::class, properties: ['name' => 'partial', 'content' => 'partial'])] 
 
class Pages 
{ 
    #[ORM\Id] 
    #[ORM\GeneratedValue] 
    #[ORM\Column] 
    #[Groups(['read', 'write'])] 
    private ?int $id = null; 
     
    #[Groups(['read', 'write'])] 
    #[ORM\Column(length: 255, nullable: true)] 
    private ?string $name = null; 
 
    #[Groups(['read', 'write'])] 
    #[ORM\ManyToOne(targetEntity: self::class)] 
    private ?self $parent = null; 
 
    #[Groups(['read', 'write'])] 
    #[ORM\Column(length: 100, nullable: true)] 
    private ?string $synonym = null; 
 
    #[ORM\Column(length: 1, nullable: true)] 
    private ?string $place = null; 
 
    #[Groups(['read', 'write'])] 
    #[ORM\Column(length: 20, nullable: true)] 
    private ?string $type = null; 
 
    #[Groups(['read', 'write'])] 
    #[ORM\Column(type: Types::TEXT, nullable: true)] 
    private ?string $content = null; 
 
    #[Groups(['read', 'write'])] 
    #[ORM\Column] 
    private ?int $orders = null; 
 
    #[Groups(['read', 'write'])] 
    #[ORM\Column(length: 10, nullable: true)] 
    private ?string $active = null; 
 
    #[ORM\Column(length: 10, nullable: true)] 
    private ?string $clickability = null; 
 
    #[ORM\Column(length: 10, nullable: true)] 
    private ?string $menu_class = null; 
 
    #[Groups(['read', 'write'])] 
    #[ORM\Column(length: 255, nullable: true)] 
    private ?string $images = null; 
     
    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 getParent(): ?self 
    { 
        return $this->parent; 
    } 
 
    public function setParent(?self $parent): self 
    { 
        $this->parent = $parent; 
 
        return $this; 
    } 
 
    public function getSynonym(): ?string 
    { 
        return $this->synonym; 
    } 
 
    public function setSynonym(?string $synonym): self 
    { 
        $this->synonym = $synonym; 
 
        return $this; 
    } 
 
    public function getPlace(): ?string 
    { 
        return $this->place; 
    } 
 
    public function setPlace(?string $place): self 
    { 
        $this->place = $place; 
 
        return $this; 
    } 
 
    public function getType(): ?string 
    { 
        return $this->type; 
    } 
 
    public function setType(?string $type): self 
    { 
        $this->type = $type; 
 
        return $this; 
    } 
 
    public function getContent(): ?string 
    { 
        return $this->content; 
    } 
 
    public function setContent(?string $content): self 
    { 
        $this->content = $content; 
 
        return $this; 
    } 
 
    public function getOrders(): ?int 
    { 
        return $this->orders; 
    } 
 
    public function setOrders(int $orders): self 
    { 
        $this->orders = $orders; 
 
        return $this; 
    } 
 
    public function getActive(): ?string 
    { 
        return $this->active; 
    } 
 
    public function setActive(?string $active): self 
    { 
        $this->active = $active; 
 
        return $this; 
    } 
 
    public function getClickability(): ?string 
    { 
        return $this->clickability; 
    } 
 
    public function setClickability(?string $clickability): self 
    { 
        $this->clickability = $clickability; 
 
        return $this; 
    } 
 
    public function getMenuClass(): ?string 
    { 
        return $this->menu_class; 
    } 
 
    public function setMenuClass(?string $menu_class): self 
    { 
        $this->menu_class = $menu_class; 
 
        return $this; 
    } 
 
    public function getImages(): ?string 
    { 
        return $this->images; 
    } 
 
    public function setImages(?string $images): self 
    { 
        $this->images = $images; 
 
        return $this; 
    } 
}