src/Entity/SyncAffectationQueue.php line 38

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Metadata\ApiResource;
  4. use ApiPlatform\Metadata\Delete;
  5. use ApiPlatform\Metadata\Get;
  6. use ApiPlatform\Metadata\GetCollection;
  7. use ApiPlatform\Metadata\Post;
  8. use ApiPlatform\Metadata\Put;
  9. use App\Controller\Action\SyncAffectationQueueBulkAction;
  10. use App\Repository\SyncAffectationQueueRepository;
  11. use Doctrine\DBAL\Types\Types;
  12. use Doctrine\ORM\Mapping as ORM;
  13. use Symfony\Component\Serializer\Annotation\Groups;
  14. #[ORM\Entity(repositoryClassSyncAffectationQueueRepository::class)]
  15. #[ORM\Table(name'sync_affectation_queue')]
  16. #[ORM\Index(name'IDX_document_id'columns: ['document_id'])]
  17. #[ORM\Index(name'IDX_site_id'columns: ['site_id'])]
  18. #[ORM\Index(name'processed'columns: ['processed'])]
  19. #[ApiResource(
  20.     operations: [
  21.         new Post(),        new Post(
  22.             name'_api_/sync_affectation_queues/bulk',
  23.             uriTemplate'/sync_affectation_queues/bulk',
  24.             controllerSyncAffectationQueueBulkAction::class,
  25.             writefalse,
  26.             readfalse,
  27.             deserializefalse
  28.         ),
  29.         new GetCollection(),
  30.         new Get()
  31.     ],
  32.     normalizationContext: ['groups' => ['syncAffectationQueue.get']],
  33.     denormalizationContext: ['groups' => ['syncAffectationQueue.write']]
  34. )]
  35. class SyncAffectationQueue
  36. {
  37.     #[ORM\Id]
  38.     #[ORM\GeneratedValue]
  39.     #[ORM\Column]
  40.     #[Groups(['syncAffectationQueue.get'])]
  41.     private ?int $id null;
  42.     #[ORM\Column(typeTypes::INTEGER)]
  43.     #[Groups(['syncAffectationQueue.get''syncAffectationQueue.write'])]
  44.     private ?int $documentId null;
  45.     #[ORM\Column(typeTypes::INTEGER)]
  46.     #[Groups(['syncAffectationQueue.get''syncAffectationQueue.write'])]
  47.     private ?int $siteId null;    #[ORM\Column(typeTypes::BOOLEANoptions: ['default' => false])]
  48.     #[Groups(['syncAffectationQueue.get''syncAffectationQueue.write'])]
  49.     private bool $isApplicable false;
  50.     #[ORM\Column(typeTypes::INTEGERnullabletrue)]
  51.     #[Groups(['syncAffectationQueue.get''syncAffectationQueue.write'])]
  52.     private ?int $createdBy null;
  53.     #[ORM\Column(typeTypes::DATETIME_MUTABLEoptions: ['default' => 'CURRENT_TIMESTAMP'])]
  54.     #[Groups(['syncAffectationQueue.get'])]
  55.     private ?\DateTimeInterface $createdAt null;    #[ORM\Column(typeTypes::DATETIME_MUTABLEoptions: ['default' => 'CURRENT_TIMESTAMP'])]
  56.     #[Groups(['syncAffectationQueue.get'])]
  57.     private ?\DateTimeInterface $updatedAt null;
  58.     #[ORM\Column(typeTypes::STRINGlength10options: ['default' => 'create'])]
  59.     #[Groups(['syncAffectationQueue.get''syncAffectationQueue.write'])]
  60.     private string $action 'create';
  61.     #[ORM\Column(typeTypes::BOOLEANoptions: ['default' => false])]
  62.     #[Groups(['syncAffectationQueue.get''syncAffectationQueue.write'])]
  63.     private bool $processed false;
  64.     public function __construct()
  65.     {
  66.         $this->createdAt = new \DateTime();
  67.         $this->updatedAt = new \DateTime();
  68.     }
  69.     public function getId(): ?int
  70.     {
  71.         return $this->id;
  72.     }
  73.     public function getDocumentId(): ?int
  74.     {
  75.         return $this->documentId;
  76.     }    public function setDocumentId(int $documentId): self
  77.     {
  78.         $this->documentId $documentId;
  79.         return $this;
  80.     }
  81.     public function getSiteId(): ?int
  82.     {
  83.         return $this->siteId;
  84.     }    public function setSiteId(int $siteId): self
  85.     {
  86.         $this->siteId $siteId;
  87.         return $this;
  88.     }
  89.     public function isApplicable(): bool
  90.     {
  91.         return $this->isApplicable;
  92.     }
  93.     public function setIsApplicable(bool $isApplicable): self
  94.     {
  95.         $this->isApplicable $isApplicable;
  96.         return $this;
  97.     }
  98.     public function getCreatedBy(): ?int
  99.     {
  100.         return $this->createdBy;
  101.     }
  102.     public function setCreatedBy(?int $createdBy): self
  103.     {
  104.         $this->createdBy $createdBy;
  105.         return $this;
  106.     }
  107.     public function getCreatedAt(): ?\DateTimeInterface
  108.     {
  109.         return $this->createdAt;
  110.     }
  111.     public function setCreatedAt(\DateTimeInterface $createdAt): self
  112.     {
  113.         $this->createdAt $createdAt;
  114.         return $this;
  115.     }
  116.     public function getUpdatedAt(): ?\DateTimeInterface
  117.     {
  118.         return $this->updatedAt;
  119.     }
  120.     public function setUpdatedAt(\DateTimeInterface $updatedAt): self
  121.     {
  122.         $this->updatedAt $updatedAt;
  123.         return $this;
  124.     }
  125.     public function isProcessed(): bool
  126.     {
  127.         return $this->processed;
  128.     }    public function setProcessed(bool $processed): self
  129.     {
  130.         $this->processed $processed;
  131.         return $this;
  132.     }
  133.     public function getAction(): string
  134.     {
  135.         return $this->action;
  136.     }
  137.     public function setAction(string $action): self
  138.     {
  139.         $this->action $action;
  140.         return $this;
  141.     }
  142.     #[ORM\PreUpdate]
  143.     public function onPreUpdate(): void
  144.     {
  145.         $this->updatedAt = new \DateTime();
  146.     }
  147. }