src/Entity/OperationSchedule.php line 48

Open in your IDE?
  1. <?php
  2. // @deprecated
  3. declare(strict_types=1);
  4. namespace App\Entity;
  5. use ApiPlatform\Core\Annotation\ApiResource;
  6. use ApiPlatform\Core\Annotation\ApiProperty;
  7. use App\Trait\TimestampableEntity;
  8. use Doctrine\Common\Collections\ArrayCollection;
  9. use Doctrine\Common\Collections\Collection;
  10. use Doctrine\ORM\Mapping as ORM;
  11. use Symfony\Component\Serializer\Annotation\Groups;
  12. use Symfony\Component\Validator\Constraints as Assert;
  13. use Ramsey\Uuid\Uuid;
  14. use Ramsey\Uuid\UuidInterface;
  15. /**
  16.  * The most generic type of item.
  17.  *
  18.  * @see https://schema.org/Thing
  19.  *
  20.  * @author Jordi Fernandes Alves <jfadev@gmail.com>
  21.  */
  22. #[ORM\Entity]
  23. #[ApiResource(
  24.     iri'OperationSchedule',
  25.     itemOperations: [
  26.         'get' => ['normalization_context' => ['groups' => 'operation_schedule:item:get']],
  27.         'put' => [
  28.             'normalization_context' => ['groups' => 'operation_schedule:item:put'],
  29.             'denormalization_context' => ['groups' => 'operation_schedule:item:put'],
  30.         ],
  31.         'delete' => [],
  32.     ],
  33.     collectionOperations: [
  34.         'get' => [
  35.             'normalization_context' => ['groups' => 'operation_schedule:collection:get'],
  36.         ],
  37.         'post' => [
  38.             'normalization_context' => ['groups' => 'operation_schedule:collection:post'],
  39.             'denormalization_context' => ['groups' => 'operation_schedule:collection:post'],
  40.         ],
  41.     ]
  42. )]
  43. class OperationSchedule
  44. {
  45.     use TimestampableEntity;
  46.     
  47.     #[ORM\Id]
  48.     #[ORM\GeneratedValue(strategy'NONE')]
  49.     #[ORM\Column(type'uuid'uniquetrue)]
  50.     #[ApiProperty(iri'https://schema.org/identifier')]
  51.     #[Groups(['operation_schedule:item:get''operation_schedule:collection:get'])]
  52.     private ?UuidInterface $id null;
  53.     #[ORM\Column(type'datetime'nullablefalse)]
  54.     #[Assert\NotNull]
  55.     #[ApiProperty(iri'https://schema.org/loadingDate')]
  56.     #[Groups(['operation_schedule:item:get''operation_schedule:item:put''operation_schedule:collection:get''operation_schedule:collection:post'])]
  57.     private ?\DateTime $loadingDate null;
  58.     #[ORM\Column(type'datetime'nullablefalse)]
  59.     #[Assert\NotNull]
  60.     #[ApiProperty(iri'https://schema.org/departureDate')]
  61.     #[Groups(['operation_schedule:item:get''operation_schedule:item:put''operation_schedule:collection:get''operation_schedule:collection:post'])]
  62.     private ?\DateTime $departureDate null;
  63.     #[ORM\Column(type'datetime'nullablefalse)]
  64.     #[Assert\NotNull]
  65.     #[ApiProperty(iri'https://schema.org/arrivalDate')]
  66.     #[Groups(['operation_schedule:item:get''operation_schedule:item:put''operation_schedule:collection:get''operation_schedule:collection:post'])]
  67.     private ?\DateTime $arrivalDate null;
  68.     #[ORM\Column(type'datetime'nullablefalse)]
  69.     #[Assert\NotNull]
  70.     #[ApiProperty(iri'https://schema.org/dischargeDate')]
  71.     #[Groups(['operation_schedule:item:get''operation_schedule:item:put''operation_schedule:collection:get''operation_schedule:collection:post'])]
  72.     private ?\DateTime $dischargeDate null;
  73.     #[ORM\Column(type'integer'nullabletrue)]
  74.     #[Assert\Type('integer')]
  75.     #[ApiProperty(iri'https://schema.org/demurragePeriod')]
  76.     #[Groups(['operation_schedule:item:get''operation_schedule:item:put''operation_schedule:collection:get''operation_schedule:collection:post'])]
  77.     private ?int $demurragePeriod null;
  78.     #[ORM\ManyToMany(targetEntity'App\Entity\Payment')]
  79.     #[ORM\InverseJoinColumn(uniquetrue)]
  80.     #[ApiProperty(iri'https://schema.org/paymentSchedule')]
  81.     #[Groups(['operation_schedule:item:get''operation_schedule:item:put''operation_schedule:collection:get''operation_schedule:collection:post'])]
  82.     private ?Collection $paymentSchedule;
  83.     public function __construct()
  84.     {
  85.         $this->id Uuid::uuid4();
  86.     }
  87.     public function getId(): ?UuidInterface
  88.     {
  89.         return $this->id;
  90.     }
  91.     public function setLoadingDate(?\DateTime $loadingDate): void
  92.     {
  93.         $this->loadingDate $loadingDate;
  94.     }
  95.     public function getLoadingDate(): ?\DateTime
  96.     {
  97.         return $this->loadingDate;
  98.     }
  99.     public function setDepartureDate(?\DateTime $departureDate): void
  100.     {
  101.         $this->departureDate $departureDate;
  102.     }
  103.     public function getDepartureDate(): ?\DateTime
  104.     {
  105.         return $this->departureDate;
  106.     }
  107.     public function setArrivalDate(?\DateTime $arrivalDate): void
  108.     {
  109.         $this->arrivalDate $arrivalDate;
  110.     }
  111.     public function getArrivalDate(): ?\DateTime
  112.     {
  113.         return $this->arrivalDate;
  114.     }
  115.     public function setDischargeDate(?\DateTime $dischargeDate): void
  116.     {
  117.         $this->dischargeDate $dischargeDate;
  118.     }
  119.     public function getDischargeDate(): ?\DateTime
  120.     {
  121.         return $this->dischargeDate;
  122.     }
  123.     public function setDemurragePeriod(?int $demurragePeriod): void
  124.     {
  125.         $this->demurragePeriod $demurragePeriod;
  126.     }
  127.     public function getDemurragePeriod(): ?int
  128.     {
  129.         return $this->demurragePeriod;
  130.     }
  131.     public function addPaymentSchedule(Payment $paymentSchedule): void
  132.     {
  133.         $this->paymentSchedule[] = $paymentSchedule;
  134.     }
  135.     public function removePaymentSchedule(Payment $paymentSchedule): void
  136.     {
  137.         $this->paymentSchedule->removeElement($paymentSchedule);
  138.     }
  139.     public function getPaymentSchedule(): Collection
  140.     {
  141.         return $this->paymentSchedule;
  142.     }
  143. }