src/Entity/Pages.php line 46

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Metadata\ApiResource;
  4. use App\Repository\PagesRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\DBAL\Types\Types;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use ApiPlatform\Metadata\ApiFilter;
  10. use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
  11. use ApiPlatform\Metadata\GetCollection;
  12. use ApiPlatform\Metadata\ApiProperty;
  13. use ApiPlatform\Metadata\Post;
  14. use ApiPlatform\Metadata\Get;
  15. use ApiPlatform\Metadata\Delete;
  16. use ApiPlatform\Metadata\Put;
  17. use Symfony\Component\HttpFoundation\File\File;
  18. use Symfony\Component\Serializer\Annotation\Groups;
  19. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  20. use App\Api\Filter\OrFilter;
  21. use App\Filter\CustomOrFilter;
  22. #[ORM\Entity(repositoryClassPagesRepository::class)]
  23. #[Get]
  24. #[Put(security"is_granted('ROLE_ADMIN')")]
  25. #[Post(security"is_granted('ROLE_ADMIN')")]
  26. #[Delete(security"is_granted('ROLE_ADMIN')")]
  27. #[ApiResource(
  28.     normalizationContext: ['groups' => ['read']],
  29.     denormalizationContext: ['groups' => ['write']],
  30.     order: ['id' => 'DESC']
  31. )]
  32. #[ApiFilter(CustomOrFilter::class,properties: [
  33.     'name' => 'ipartial'
  34.     'content' => 'ipartial'
  35. ])]
  36. #[ApiFilter(SearchFilter::class, properties: ['synonym' => 'exact''type' => 'exact'])]
  37. // #[ApiFilter(OrFilter::class, properties: ['name' => 'partial', 'content' => 'partial'])]
  38. class Pages
  39. {
  40.     #[ORM\Id]
  41.     #[ORM\GeneratedValue]
  42.     #[ORM\Column]
  43.     #[Groups(['read''write'])]
  44.     private ?int $id null;
  45.     
  46.     #[Groups(['read''write'])]
  47.     #[ORM\Column(length255nullabletrue)]
  48.     private ?string $name null;
  49.     #[Groups(['read''write'])]
  50.     #[ORM\ManyToOne(targetEntityself::class)]
  51.     private ?self $parent null;
  52.     #[Groups(['read''write'])]
  53.     #[ORM\Column(length100nullabletrue)]
  54.     private ?string $synonym null;
  55.     #[ORM\Column(length1nullabletrue)]
  56.     private ?string $place null;
  57.     #[Groups(['read''write'])]
  58.     #[ORM\Column(length20nullabletrue)]
  59.     private ?string $type null;
  60.     #[Groups(['read''write'])]
  61.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  62.     private ?string $content null;
  63.     #[Groups(['read''write'])]
  64.     #[ORM\Column]
  65.     private ?int $orders null;
  66.     #[Groups(['read''write'])]
  67.     #[ORM\Column(length10nullabletrue)]
  68.     private ?string $active null;
  69.     #[ORM\Column(length10nullabletrue)]
  70.     private ?string $clickability null;
  71.     #[ORM\Column(length10nullabletrue)]
  72.     private ?string $menu_class null;
  73.     #[Groups(['read''write'])]
  74.     #[ORM\Column(length255nullabletrue)]
  75.     private ?string $images null;
  76.     
  77.     public function getId(): ?int
  78.     {
  79.         return $this->id;
  80.     }
  81.     public function getName(): ?string
  82.     {
  83.         return $this->name;
  84.     }
  85.     public function setName(?string $name): self
  86.     {
  87.         $this->name $name;
  88.         return $this;
  89.     }
  90.     public function getParent(): ?self
  91.     {
  92.         return $this->parent;
  93.     }
  94.     public function setParent(?self $parent): self
  95.     {
  96.         $this->parent $parent;
  97.         return $this;
  98.     }
  99.     public function getSynonym(): ?string
  100.     {
  101.         return $this->synonym;
  102.     }
  103.     public function setSynonym(?string $synonym): self
  104.     {
  105.         $this->synonym $synonym;
  106.         return $this;
  107.     }
  108.     public function getPlace(): ?string
  109.     {
  110.         return $this->place;
  111.     }
  112.     public function setPlace(?string $place): self
  113.     {
  114.         $this->place $place;
  115.         return $this;
  116.     }
  117.     public function getType(): ?string
  118.     {
  119.         return $this->type;
  120.     }
  121.     public function setType(?string $type): self
  122.     {
  123.         $this->type $type;
  124.         return $this;
  125.     }
  126.     public function getContent(): ?string
  127.     {
  128.         return $this->content;
  129.     }
  130.     public function setContent(?string $content): self
  131.     {
  132.         $this->content $content;
  133.         return $this;
  134.     }
  135.     public function getOrders(): ?int
  136.     {
  137.         return $this->orders;
  138.     }
  139.     public function setOrders(int $orders): self
  140.     {
  141.         $this->orders $orders;
  142.         return $this;
  143.     }
  144.     public function getActive(): ?string
  145.     {
  146.         return $this->active;
  147.     }
  148.     public function setActive(?string $active): self
  149.     {
  150.         $this->active $active;
  151.         return $this;
  152.     }
  153.     public function getClickability(): ?string
  154.     {
  155.         return $this->clickability;
  156.     }
  157.     public function setClickability(?string $clickability): self
  158.     {
  159.         $this->clickability $clickability;
  160.         return $this;
  161.     }
  162.     public function getMenuClass(): ?string
  163.     {
  164.         return $this->menu_class;
  165.     }
  166.     public function setMenuClass(?string $menu_class): self
  167.     {
  168.         $this->menu_class $menu_class;
  169.         return $this;
  170.     }
  171.     public function getImages(): ?string
  172.     {
  173.         return $this->images;
  174.     }
  175.     public function setImages(?string $images): self
  176.     {
  177.         $this->images $images;
  178.         return $this;
  179.     }
  180. }