<?php
namespace App\Dto;
use App\Entity\Category;
use Symfony\Component\Serializer\Annotation\Groups;
use ApiPlatform\Metadata\ApiFilter;
use ApiPlatform\Metadata\ApiProperty;
use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Doctrine\Orm\Filter\BooleanFilter;
use ApiPlatform\Doctrine\Orm\Filter\DateFilter;
use ApiPlatform\Doctrine\Orm\Filter\OrderFilter;
use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
#[ApiResource]
#[ApiFilter(OrderFilter::class)]
#[ApiFilter(DateFilter::class, properties: ["createdAt"])]
#[ApiFilter(SearchFilter::class)]
#[ApiFilter(SearchFilter::class, properties: ["name" => "partial"])]
#[ApiFilter(BooleanFilter::class, properties: ["public" => "exact"])]
final class CategoryOutput extends Category
{
/**
* @var int
*/
#[Groups(['category:read'])]
public $id;
/**
* @var string
*/
#[Groups(['category:read'])]
public $name;
/**
* @var string
*/
#[Groups(['category:read'])]
public $slug;
/**
* @var int
*/
#[Groups(['category:read'])]
public $type;
/**
* @var int
*/
#[Groups(['category:read'])]
public $parentType;
/**
* @var string
*/
#[Groups(['category:read'])]
public $parentName;
/**
* @return string
*/
public function getName(): string
{
return $this->name;
}
/**
* @param string
*/
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
/**
* @return string
*/
public function getSlug(): string
{
return $this->slug;
}
/**
* @param string
*/
public function setSlug(string $slug): self
{
$this->slug = $slug;
return $this;
}
/**
* @return int
*/
public function getType(): int
{
return $this->type;
}
/**
* @param int
*/
public function setType(int $type): self
{
$this->type = $type;
return $this;
}
/**
* @return int
*/
public function getId(): int
{
return $this->id;
}
/**
* @param int
*/
public function setId(int $id)
{
$this->id = $id;
}
/**
* @return int
*/
public function getParentType(): ?int
{
return $this->parentType;
}
/**
* @param int
*/
public function setParentType(?int $parentType)
{
$this->parentType = $parentType;
}
/**
* @return string
*/
public function getParentName(): ?string
{
return $this->parentName;
}
/**
* @param string
*/
public function setParentName(?string $parentName)
{
$this->parentName = $parentName;
}
}