src/Dto/CategoryOutput.php line 22

Open in your IDE?
  1. <?php
  2. namespace App\Dto;
  3. use App\Entity\Category;
  4. use Symfony\Component\Serializer\Annotation\Groups;
  5. use ApiPlatform\Metadata\ApiFilter;
  6. use ApiPlatform\Metadata\ApiProperty;
  7. use ApiPlatform\Metadata\ApiResource;
  8. use ApiPlatform\Doctrine\Orm\Filter\BooleanFilter;
  9. use ApiPlatform\Doctrine\Orm\Filter\DateFilter;
  10. use ApiPlatform\Doctrine\Orm\Filter\OrderFilter;
  11. use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
  12. #[ApiResource]
  13. #[ApiFilter(OrderFilter::class)]
  14. #[ApiFilter(DateFilter::class, properties: ["createdAt"])]
  15. #[ApiFilter(SearchFilter::class)]
  16. #[ApiFilter(SearchFilter::class, properties: ["name" => "partial"])]
  17. #[ApiFilter(BooleanFilter::class, properties: ["public" => "exact"])]
  18. final class CategoryOutput extends Category
  19. {
  20.     /**
  21.      * @var int
  22.      */
  23.     #[Groups(['category:read'])]
  24.     public $id;
  25.     /**
  26.      * @var string
  27.      */
  28.     #[Groups(['category:read'])]
  29.     public $name;
  30.     /**
  31.      * @var string
  32.      */
  33.     #[Groups(['category:read'])]
  34.     public $slug;
  35.     /**
  36.      * @var int
  37.      */
  38.     #[Groups(['category:read'])]
  39.     public $type;
  40.     /**
  41.      * @var int
  42.      */
  43.     #[Groups(['category:read'])]
  44.     public $parentType;
  45.     /**
  46.      * @var string
  47.      */
  48.     #[Groups(['category:read'])]
  49.     public $parentName;
  50.     /**
  51.      * @return string
  52.      */
  53.     public function getName(): string
  54.     {
  55.         return $this->name;
  56.     }
  57.     /**
  58.      * @param string
  59.      */
  60.     public function setName(string $name): self
  61.     {
  62.         $this->name $name;
  63.         return $this;
  64.     }
  65.     /**
  66.      * @return string
  67.      */
  68.     public function getSlug(): string
  69.     {
  70.         return $this->slug;
  71.     }
  72.     /**
  73.      * @param string
  74.      */
  75.      public function setSlug(string $slug): self
  76.      {
  77.          $this->slug $slug;
  78.  
  79.          return $this;
  80.      }
  81.     /**
  82.      * @return int
  83.      */
  84.     public function getType(): int
  85.     {
  86.         return $this->type;
  87.     }
  88.     /**
  89.      * @param int
  90.      */
  91.     public function setType(int $type): self
  92.     {
  93.         $this->type $type;
  94.         return $this;
  95.     }
  96.     /**
  97.      * @return int
  98.      */
  99.     public function getId(): int
  100.     {
  101.         return $this->id;
  102.     }
  103.     /**
  104.      * @param int
  105.      */
  106.     public function setId(int $id)
  107.     {
  108.         $this->id $id;
  109.     }
  110.     /**
  111.      * @return int
  112.      */
  113.     public function getParentType(): ?int
  114.     {
  115.         return $this->parentType;
  116.     }
  117.     /**
  118.      * @param int
  119.      */
  120.     public function setParentType(?int $parentType)
  121.     {
  122.         $this->parentType $parentType;
  123.     }
  124.     /**
  125.      * @return string
  126.      */
  127.     public function getParentName(): ?string
  128.     {
  129.         return $this->parentName;
  130.     }
  131.     /**
  132.      * @param string
  133.      */
  134.     public function setParentName(?string $parentName)
  135.     {
  136.         $this->parentName $parentName;
  137.     }
  138. }