src/Entity/SpMethods.php line 23

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Metadata\ApiResource;
  4. use App\Repository\SpMethodsRepository;
  5. use Doctrine\DBAL\Types\Types;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\Serializer\Annotation\Groups;
  8. use ApiPlatform\Metadata\ApiFilter;
  9. use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
  10. #[ORM\Entity(repositoryClassSpMethodsRepository::class)]
  11. #[ApiResource(
  12.     normalizationContext: ['groups' => ['sp:read']],
  13.     denormalizationContext: ['groups' => ['sp:write']],
  14.     order: ['id' => 'DESC']
  15. )]
  16. #[ApiFilter(SearchFilter::class, properties: [
  17.     'slug' => 'exact'
  18.     'name' => 'partial' 
  19. ])]
  20. class SpMethods
  21. {
  22.     #[Groups(['sp:read''sp:write'])]
  23.     #[ORM\Id]
  24.     #[ORM\GeneratedValue]
  25.     #[ORM\Column]
  26.     private ?int $id null;
  27.     #[Groups(['sp:read''sp:write'])]
  28.     #[ORM\Column(length255nullabletrue)]
  29.     private ?string $name null;
  30.     #[Groups(['sp:read''sp:write'])]
  31.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  32.     private ?string $content null;
  33.     #[Groups(['sp:read''sp:write'])]
  34.     #[ORM\Column(nullabletrue)]
  35.     private ?array $object null;
  36.     #[Groups(['sp:read''sp:write'])]
  37.     #[ORM\ManyToOne(inversedBy'spMethods')]
  38.     private ?Form $form null;
  39.     #[Groups(['sp:read''sp:write'])]
  40.     #[ORM\Column(length50nullabletrue)]
  41.     private ?string $slug null;
  42.     public function getId(): ?int
  43.     {
  44.         return $this->id;
  45.     }
  46.     public function getName(): ?string
  47.     {
  48.         return $this->name;
  49.     }
  50.     public function setName(?string $name): static
  51.     {
  52.         $this->name $name;
  53.         return $this;
  54.     }
  55.     public function getContent(): ?string
  56.     {
  57.         return $this->content;
  58.     }
  59.     public function setContent(?string $content): static
  60.     {
  61.         $this->content $content;
  62.         return $this;
  63.     }
  64.     public function getObject(): ?array
  65.     {
  66.         return $this->object;
  67.     }
  68.     public function setObject(?array $object): static
  69.     {
  70.         $this->object $object;
  71.         return $this;
  72.     }
  73.     public function getForm(): ?Form
  74.     {
  75.         return $this->form;
  76.     }
  77.     public function setForm(?Form $form): static
  78.     {
  79.         $this->form $form;
  80.         return $this;
  81.     }
  82.     public function getSlug(): ?string
  83.     {
  84.         return $this->slug;
  85.     }
  86.     public function setSlug(?string $slug): static
  87.     {
  88.         $this->slug $slug;
  89.         return $this;
  90.     }
  91. }