WebflowCollection.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Core\Annotation\ApiProperty;
  4. use ApiPlatform\Core\Annotation\ApiResource;
  5. use ApiPlatform\Core\Annotation\ApiSubresource;
  6. use App\Serializer\ItemSerializedName;
  7. use Symfony\Component\Serializer\Annotation\Groups;
  8. /**
  9. * @ApiResource(
  10. * itemOperations={"get"},
  11. * collectionOperations={"get"},
  12. * )
  13. */
  14. class WebflowCollection extends AbstractWebflowEntity {
  15. /**
  16. * @ApiProperty(identifier=true)
  17. * @ItemSerializedName("_id")
  18. */
  19. protected $id;
  20. private $name;
  21. private $slug;
  22. private $singularName;
  23. private $lastUpdated;
  24. private $createdOn;
  25. public function getName(): ?string {
  26. return $this->name;
  27. }
  28. public function setName(string $name): self {
  29. $this->name = $name;
  30. return $this;
  31. }
  32. public function getSlug(): ?string {
  33. return $this->slug;
  34. }
  35. public function setSlug(string $name): self {
  36. $this->slug = $name;
  37. return $this;
  38. }
  39. public function getSingularName(): ?string {
  40. return $this->singularName;
  41. }
  42. protected function setSingularName(string $name): self {
  43. $this->singularName = $name;
  44. return $this;
  45. }
  46. public function getLastUpdated(): \DateTimeInterface {
  47. return $this->lastUpdated ?? new \DateTimeImmutable($this->lastUpdated);
  48. }
  49. protected function setLastUpdated(string $data): self {
  50. $this->lastUpdated = new \DateTimeImmutable($data);
  51. return $this;
  52. }
  53. public function getCreatedOn(): \DateTimeInterface {
  54. return $this->createdOn ?? new \DateTimeImmutable($this->createdOn);
  55. }
  56. protected function setCreatedOn(string $data): self {
  57. $this->createdOn = new \DateTimeImmutable($data);
  58. return $this;
  59. }
  60. }