WebflowCollection.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Core\Annotation\ApiProperty;
  4. use ApiPlatform\Core\Annotation\ApiResource;
  5. use App\Http\WebflowApi\WebflowApiCollection;
  6. use DateTimeImmutable;
  7. /**
  8. * @ApiResource(
  9. * collectionOperations={"get"},
  10. * itemOperations={"get"}
  11. * )
  12. */
  13. class WebflowCollection extends AbstractEntity {
  14. /**
  15. * @ApiProperty(identifier=true)
  16. */
  17. protected $id;
  18. private $name;
  19. private $slug;
  20. private $singularName;
  21. protected $lastUpdated;
  22. protected $createdOn;
  23. public function __construct(WebflowApiCollection $webflowApiCollection) {
  24. $this->setFromData($webflowApiCollection->data);
  25. }
  26. public function getId(): ?string {
  27. return $this->id;
  28. }
  29. public function getSingularName(): ?string {
  30. return $this->singularName;
  31. }
  32. public function setSingularName(string $sn): self {
  33. $this->singularName = $sn;
  34. return $this;
  35. }
  36. public function getLastUpdated(): \DateTimeInterface {
  37. return new DateTimeImmutable($this->lastUpdated);
  38. }
  39. public function getCreatedOn(): \DateTimeInterface {
  40. return new DateTimeImmutable($this->lastUpdated);
  41. }
  42. }