src/Entity/PmMethods.php line 24

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Metadata\ApiResource;
  4. use App\Repository\PmMethodsRepository;
  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(repositoryClassPmMethodsRepository::class)]
  11. #[ApiResource(
  12.     normalizationContext: ['groups' => ['pm:read']],
  13.     denormalizationContext: ['groups' => ['pm:write']],
  14.     order: ['id' => 'DESC']
  15. )]
  16. #[ApiFilter(SearchFilter::class, properties: [
  17.     'slug' => 'exact'
  18.     'name' => 'partial' 
  19. ])]
  20. class PmMethods
  21. {
  22.     #[Groups(['pm:read''pm:write'])]
  23.     #[ORM\Id]
  24.     #[ORM\GeneratedValue]
  25.     #[ORM\Column]
  26.     private ?int $id null;
  27.     #[Groups(['pm:read''pm:write'])]
  28.     #[ORM\Column(length255nullabletrue)]
  29.     private ?string $name null;
  30.     #[Groups(['pm:read''pm:write'])]
  31.     #[ORM\Column(length50nullabletrue)]
  32.     private ?string $slug null;
  33.     #[Groups(['pm:read''pm:write'])]
  34.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  35.     private ?string $content null;
  36.     #[Groups(['pm:read''pm:write'])]
  37.     #[ORM\Column(nullabletrue)]
  38.     private ?array $object null;
  39.     public function getId(): ?int
  40.     {
  41.         return $this->id;
  42.     }
  43.     public function getName(): ?string
  44.     {
  45.         return $this->name;
  46.     }
  47.     public function setName(?string $name): static
  48.     {
  49.         $this->name $name;
  50.         return $this;
  51.     }
  52.     public function getSlug(): ?string
  53.     {
  54.         return $this->slug;
  55.     }
  56.     public function setSlug(?string $slug): static
  57.     {
  58.         $this->slug $slug;
  59.         return $this;
  60.     }
  61.     public function getContent(): ?string
  62.     {
  63.         return $this->content;
  64.     }
  65.     public function setContent(?string $content): static
  66.     {
  67.         $this->content $content;
  68.         return $this;
  69.     }
  70.     public function getObject(): ?array
  71.     {
  72.         return $this->object;
  73.     }
  74.     public function setObject(?array $object): static
  75.     {
  76.         $this->object $object;
  77.         return $this;
  78.     }
  79. }