src/Entity/Faq.php line 36

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Metadata\ApiResource;
  4. use App\Repository\FaqRepository;
  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\Get;
  10. use ApiPlatform\Metadata\Post;
  11. use ApiPlatform\Metadata\Put;
  12. use ApiPlatform\Metadata\Delete;
  13. use Symfony\Component\Serializer\Annotation\Groups;
  14. use ApiPlatform\Metadata\ApiFilter;
  15. use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
  16. #[ORM\Entity(repositoryClassFaqRepository::class)]
  17. #[Get]
  18. #[Put(security"is_granted('ROLE_ADMIN')")]
  19. #[Post(security"is_granted('ROLE_ADMIN')")]
  20. #[Delete(security"is_granted('ROLE_ADMIN')")]
  21. #[ApiResource(
  22.     normalizationContext: ['groups' => ['faq:read']],
  23.     denormalizationContext: ['groups' => ['faq:write']],
  24.     order: ['id' => 'DESC'],
  25.     // paginationPartial: true
  26. )]
  27. #[ApiFilter(SearchFilter::class, properties: [
  28.     'name' => 'ipartial',
  29.     'category.id' => 'exact',
  30. ])]
  31. class Faq
  32. {
  33.     #[Groups(['faq:read''faq:write'])]
  34.     #[ORM\Id]
  35.     #[ORM\GeneratedValue]
  36.     #[ORM\Column]
  37.     private ?int $id null;
  38.     #[Groups(['faq:read''faq:write'])]
  39.     #[ORM\Column(length255)]
  40.     private ?string $name null;
  41.     #[Groups(['faq:read''faq:write'])]
  42.     #[ORM\Column(typeTypes::DATETIME_MUTABLE)]
  43.     private ?\DateTimeInterface $date null;
  44.     #[Groups(['faq:read''faq:write'])]
  45.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  46.     private ?string $contentShort null;
  47.     #[Groups(['faq:read''faq:write'])]
  48.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  49.     private ?string $contentFull null;
  50.     #[Groups(['faq:read''faq:write'])]
  51.     #[ORM\Column(length2)]
  52.     private ?string $active null;
  53.     #[Groups(['faq:read''faq:write'])]
  54.     #[ORM\Column(length2nullabletrue)]
  55.     private ?string $top null;
  56.     #[Groups(['faq:read''faq:write'])]
  57.     #[ORM\ManyToOne(inversedBy'faqs')]
  58.     private ?User $createdUser null;
  59.     #[Groups(['faq:read''faq:write'])]
  60.     #[ORM\ManyToOne(inversedBy'modifiedFaq')]
  61.     private ?User $modifiedUser null;
  62.     #[Groups(['faq:read''faq:write'])]
  63.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  64.     private ?\DateTimeInterface $dateEntered null;
  65.     #[Groups(['faq:read''faq:write'])]
  66.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  67.     private ?\DateTimeInterface $dateModified null;
  68.     public function getId(): ?int
  69.     {
  70.         return $this->id;
  71.     }
  72.     public function getName(): ?string
  73.     {
  74.         return $this->name;
  75.     }
  76.     public function setName(string $name): self
  77.     {
  78.         $this->name $name;
  79.         return $this;
  80.     }
  81.     public function getDate(): ?\DateTimeInterface
  82.     {
  83.         return $this->date;
  84.     }
  85.     public function setDate(\DateTimeInterface $date): self
  86.     {
  87.         $this->date $date;
  88.         return $this;
  89.     }
  90.     public function getContentShort(): ?string
  91.     {
  92.         return $this->contentShort;
  93.     }
  94.     public function setContentShort(?string $contentShort): self
  95.     {
  96.         $this->contentShort $contentShort;
  97.         return $this;
  98.     }
  99.     public function getContentFull(): ?string
  100.     {
  101.         return $this->contentFull;
  102.     }
  103.     public function setContentFull(?string $contentFull): self
  104.     {
  105.         $this->contentFull $contentFull;
  106.         return $this;
  107.     }
  108.     public function getActive(): ?string
  109.     {
  110.         return $this->active;
  111.     }
  112.     public function setActive(string $active): self
  113.     {
  114.         $this->active $active;
  115.         return $this;
  116.     }
  117.     public function getTop(): ?string
  118.     {
  119.         return $this->top;
  120.     }
  121.     public function setTop(?string $top): self
  122.     {
  123.         $this->top $top;
  124.         return $this;
  125.     }
  126.     public function getCreatedUser(): ?User
  127.     {
  128.         return $this->createdUser;
  129.     }
  130.     public function setCreatedUser(?User $createdUser): static
  131.     {
  132.         $this->createdUser $createdUser;
  133.         return $this;
  134.     }
  135.     public function getModifiedUser(): ?User
  136.     {
  137.         return $this->modifiedUser;
  138.     }
  139.     public function setModifiedUser(?User $modifiedUser): static
  140.     {
  141.         $this->modifiedUser $modifiedUser;
  142.         return $this;
  143.     }
  144.     public function getDateEntered(): ?\DateTimeInterface
  145.     {
  146.         return $this->dateEntered;
  147.     }
  148.     public function setDateEntered(?\DateTimeInterface $dateEntered): static
  149.     {
  150.         $this->dateEntered $dateEntered;
  151.         return $this;
  152.     }
  153.     public function getDateModified(): ?\DateTimeInterface
  154.     {
  155.         return $this->dateModified;
  156.     }
  157.     public function setDateModified(?\DateTimeInterface $dateModified): static
  158.     {
  159.         $this->dateModified $dateModified;
  160.         return $this;
  161.     }
  162. }