src/Entity/Options.php line 22

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Metadata\ApiResource;
  4. use App\Repository\OptionsRepository;
  5. use Doctrine\DBAL\Types\Types;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use ApiPlatform\Metadata\Get;
  8. use ApiPlatform\Metadata\Post;
  9. use ApiPlatform\Metadata\Put;
  10. use ApiPlatform\Metadata\Delete;
  11. use ApiPlatform\Metadata\ApiFilter;
  12. use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
  13. #[ORM\Entity(repositoryClassOptionsRepository::class)]
  14. #[ApiResource]
  15. #[ApiFilter(SearchFilter::class, properties: ['option_key' => 'exact'])]
  16. #[ORM\HasLifecycleCallbacks
  17. class Options
  18.     #[ORM\Id]
  19.     #[ORM\GeneratedValue(strategy'IDENTITY')]
  20.     #[ORM\Column]
  21.     private ?int $id null;
  22.     #[ORM\Column(length100)]
  23.     private ?string $option_key null;
  24.     #[ORM\Column(length255)]
  25.     private ?string $value null;
  26.     #[ORM\Column(typeTypes::DATETIME_MUTABLE)]
  27.     private ?\DateTimeInterface $date null;
  28.     #[ORM\Column(length255)]
  29.     private ?string $name null;
  30.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  31.     private ?string $data null;
  32.     public function getId(): ?int
  33.     {
  34.         return $this->id;
  35.     }
  36.     public function getOptionKey(): ?string
  37.     {
  38.         return $this->option_key;
  39.     }
  40.     public function setOptionKey(string $option_key): self
  41.     {
  42.         $this->option_key $option_key;
  43.         return $this;
  44.     }
  45.     public function getValue(): ?string
  46.     {
  47.         return $this->value;
  48.     }
  49.     public function setValue(string $value): self
  50.     {
  51.         $this->value $value;
  52.         return $this;
  53.     }
  54.     public function getDate(): ?\DateTimeInterface
  55.     {
  56.         return $this->date;
  57.     }
  58.     public function setDate(\DateTimeInterface $date): self
  59.     {
  60.         $this->date $date;
  61.         return $this;
  62.     }
  63.     public function getName(): ?string
  64.     {
  65.         return $this->name;
  66.     }
  67.     public function setName(string $name): self
  68.     {
  69.         $this->name $name;
  70.         return $this;
  71.     }
  72.     public function getData(): ?string
  73.     {
  74.         return $this->data;
  75.     }
  76.     public function setData(?string $data): self
  77.     {
  78.         $this->data $data;
  79.         return $this;
  80.     }
  81.     #[ORM\PrePersist]
  82.     public function setCreatedAtValue(): void
  83.     {
  84.         $this->date = new \DateTime();
  85.     }
  86. }