src/Entity/Hire.php line 45

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Entity;
  4. use ApiPlatform\Core\Annotation\ApiResource;
  5. use ApiPlatform\Core\Annotation\ApiProperty;
  6. use App\Trait\TimestampableEntity;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Symfony\Component\Serializer\Annotation\Groups;
  9. use Symfony\Component\Validator\Constraints as Assert;
  10. use Symfony\Component\Serializer\Annotation\MaxDepth;
  11. use Ramsey\Uuid\Uuid;
  12. use Ramsey\Uuid\UuidInterface;
  13. /**
  14.  * The most generic type of item.
  15.  *
  16.  * @see https://schema.org/Thing
  17.  *
  18.  * @author Jordi Fernandes Alves <jfadev@gmail.com>
  19.  */
  20. #[ORM\Entity]
  21. #[ApiResource(
  22.     iri'Hire',
  23.     itemOperations: [
  24.         'get' => ['normalization_context' => ['groups' => 'hire:item:get']],
  25.         'put' => [
  26.             'normalization_context' => ['groups' => 'hire:item:put'],
  27.             'denormalization_context' => ['groups' => 'hire:item:put'],
  28.         ],
  29.         'delete' => [],
  30.     ],
  31.     collectionOperations: [
  32.         'get' => [
  33.             'normalization_context' => ['groups' => 'hire:collection:get'],
  34.         ],
  35.         'post' => [
  36.             'normalization_context' => ['groups' => 'hire:collection:post'],
  37.             'denormalization_context' => ['groups' => 'hire:collection:post'],
  38.         ],
  39.     ]
  40. )]
  41. class Hire
  42. {
  43.     use TimestampableEntity;
  44.     
  45.     #[ORM\Id]
  46.     #[ORM\GeneratedValue(strategy'NONE')]
  47.     #[ORM\Column(type'uuid'uniquetrue)]
  48.     private ?UuidInterface $id null;
  49.     #[ORM\Column(type'datetime'nullabletrue)]
  50.     #[ApiProperty(iri'https://schema.org/hireBegin')]
  51.     #[Assert\Type(\DateTimeInterface::class)]
  52.     #[Groups(['hire:collection:get''hire:collection:post''hire:item:get''hire:item:put''contract:collection:post''contract:item:get''contract:item:put'])]
  53.     private ?\DateTimeInterface $hireBegin null;
  54.     #[ApiProperty(iri'https://schema.org/hireBeginDate')]
  55.     #[Groups(['contract:item:get'])]
  56.     private ?string $hireBeginDate null;
  57.     #[ApiProperty(iri'https://schema.org/hireBeginTime')]
  58.     #[Groups(['contract:item:get'])]
  59.     private ?string $hireBeginTime null;
  60.     #[ORM\Column(type'datetime'nullabletrue)]
  61.     #[ApiProperty(iri'https://schema.org/hireEnd')]
  62.     #[Assert\Type(\DateTimeInterface::class)]
  63.     #[Groups(['hire:collection:get''hire:collection:post''hire:item:get''hire:item:put''contract:collection:post''contract:item:get''contract:item:put'])]
  64.     private ?\DateTimeInterface $hireEnd null;
  65.     #[ApiProperty(iri'https://schema.org/hireEndDate')]
  66.     #[Groups(['contract:item:get'])]
  67.     private ?string $hireEndDate null;
  68.     #[ApiProperty(iri'https://schema.org/hireEndTime')]
  69.     #[Groups(['contract:item:get'])]
  70.     private ?string $hireEndTime null;
  71.     #[ORM\Column(type'string'nullabletrue)]
  72.     #[ApiProperty(iri'https://schema.org/fuelType')]
  73.     #[Assert\Type('string')]
  74.     #[Groups(['hire:collection:get''hire:collection:post''hire:item:get''hire:item:put''contract:collection:post''contract:item:get''contract:item:put'])]
  75.     private ?string $fuelType null;
  76.     #[ORM\Column(type'string'nullabletrue)]
  77.     #[ApiProperty(iri'https://schema.org/fuelType2')]
  78.     #[Assert\Type('string')]
  79.     #[Groups(['hire:collection:get''hire:collection:post''hire:item:get''hire:item:put''contract:collection:post''contract:item:get''contract:item:put'])]
  80.     private ?string $fuelType2 null;
  81.     #[ORM\Column(type'string'nullabletrue)]
  82.     #[ApiProperty(iri'https://schema.org/fuelType3')]
  83.     #[Assert\Type('string')]
  84.     #[Groups(['hire:collection:get''hire:collection:post''hire:item:get''hire:item:put''contract:collection:post''contract:item:get''contract:item:put'])]
  85.     private ?string $fuelType3 null;
  86.     #[ORM\Column(type'string'nullabletrue)]
  87.     #[ApiProperty(iri'https://schema.org/price')]
  88.     #[Assert\Type('string')]
  89.     #[Groups(['hire:collection:get''hire:collection:post''hire:item:get''hire:item:put''contract:collection:post''contract:item:get''contract:item:put'])]
  90.     private ?string $price null;
  91.     #[ORM\Column(type'string'nullabletrue)]
  92.     #[ApiProperty(iri'https://schema.org/price2')]
  93.     #[Assert\Type('string')]
  94.     #[Groups(['hire:collection:get''hire:collection:post''hire:item:get''hire:item:put''contract:collection:post''contract:item:get''contract:item:put'])]
  95.     private ?string $price2 null;
  96.     #[ORM\Column(type'string'nullabletrue)]
  97.     #[ApiProperty(iri'https://schema.org/price3')]
  98.     #[Assert\Type('string')]
  99.     #[Groups(['hire:collection:get''hire:collection:post''hire:item:get''hire:item:put''contract:collection:post''contract:item:get''contract:item:put'])]
  100.     private ?string $price3 null;
  101.     #[ORM\Column(type'string'nullabletrue)]
  102.     #[ApiProperty(iri'https://schema.org/priceCurrency')]
  103.     #[Assert\Type('string')]
  104.     #[Groups(['hire:collection:get''hire:collection:post''hire:item:get''hire:item:put''contract:collection:post''contract:item:get''contract:item:put'])]
  105.     private ?string $priceCurrency null;
  106.     #[ORM\Column(type'string'nullabletrue)]
  107.     #[ApiProperty(iri'https://schema.org/priceCurrency2')]
  108.     #[Assert\Type('string')]
  109.     #[Groups(['hire:collection:get''hire:collection:post''hire:item:get''hire:item:put''contract:collection:post''contract:item:get''contract:item:put'])]
  110.     private ?string $priceCurrency2 null;
  111.     #[ORM\Column(type'string'nullabletrue)]
  112.     #[ApiProperty(iri'https://schema.org/priceCurrency3')]
  113.     #[Assert\Type('string')]
  114.     #[Groups(['hire:collection:get''hire:collection:post''hire:item:get''hire:item:put''contract:collection:post''contract:item:get''contract:item:put'])]
  115.     private ?string $priceCurrency3 null;
  116.     #[ORM\Column(type'boolean'nullabletrue)]
  117.     #[ApiProperty(iri'https://schema.org/multiFuel')]
  118.     #[Groups(['hire:collection:get''hire:collection:post''hire:item:get''hire:item:put''contract:collection:post''contract:item:get''contract:item:put'])]
  119.     private ?bool $multiFuel false;
  120.     #[ORM\Column(type'datetime'nullabletrue)]
  121.     #[ApiProperty(iri'https://schema.org/offHireBegin')]
  122.     #[Assert\Type(\DateTimeInterface::class)]
  123.     #[Groups(['hire:collection:get''hire:collection:post''hire:item:get''hire:item:put''contract:collection:post''contract:item:get''contract:item:put'])]
  124.     private ?\DateTimeInterface $offHireBegin null;
  125.     #[ApiProperty(iri'https://schema.org/offHireBeginDate')]
  126.     #[Groups(['contract:item:get'])]
  127.     private ?string $offHireBeginDate null;
  128.     #[ApiProperty(iri'https://schema.org/offHireBeginTime')]
  129.     #[Groups(['contract:item:get'])]
  130.     private ?string $offHireBeginTime null;
  131.     #[ORM\Column(type'datetime'nullabletrue)]
  132.     #[ApiProperty(iri'https://schema.org/offHireEnd')]
  133.     #[Assert\Type(\DateTimeInterface::class)]
  134.     #[Groups(['hire:collection:get''hire:collection:post''hire:item:get''hire:item:put''contract:collection:post''contract:item:get''contract:item:put'])]
  135.     private ?\DateTimeInterface $offHireEnd null;
  136.     #[ApiProperty(iri'https://schema.org/offHireEndDate')]
  137.     #[Groups(['contract:item:get'])]
  138.     private ?string $offHireEndDate null;
  139.     #[ApiProperty(iri'https://schema.org/offHireEndTime')]
  140.     #[Groups(['contract:item:get'])]
  141.     private ?string $offHireEndTime null;
  142.     #[ORM\Column(type'string'nullabletrue)]
  143.     #[ApiProperty(iri'https://schema.org/offHireCost')]
  144.     #[Assert\Type('string')]
  145.     #[Groups(['hire:collection:get''hire:collection:post''hire:item:get''hire:item:put''contract:collection:post''contract:item:get''contract:item:put'])]
  146.     private ?string $offHireCost null;
  147.     #[ORM\Column(type'string'nullabletrue)]
  148.     #[ApiProperty(iri'https://schema.org/offHireCostCurrency')]
  149.     #[Assert\Type('string')]
  150.     #[Groups(['hire:collection:get''hire:collection:post''hire:item:get''hire:item:put''contract:collection:post''contract:item:get''contract:item:put'])]
  151.     private ?string $offHireCostCurrency null;
  152.     #[ORM\Column(type'string'nullabletrue)]
  153.     #[ApiProperty(iri'https://schema.org/addressCommission')]
  154.     #[Assert\Type('string')]
  155.     #[Groups(['hire:collection:get''hire:collection:post''hire:item:get''hire:item:put''contract:collection:post''contract:item:get''contract:item:put'])]
  156.     private ?string $addressCommission null;
  157.     #[ORM\Column(type'string'nullabletrue)]
  158.     #[ApiProperty(iri'https://schema.org/extraCosts')]
  159.     #[Assert\Type('string')]
  160.     #[Groups(['hire:collection:get''hire:collection:post''hire:item:get''hire:item:put''contract:collection:post''contract:item:get''contract:item:put'])]
  161.     private ?string $extraCosts null;
  162.     #[ORM\Column(type'string'nullabletrue)]
  163.     #[ApiProperty(iri'https://schema.org/extraCostsCurrency')]
  164.     #[Assert\Type('string')]
  165.     #[Groups(['hire:collection:get''hire:collection:post''hire:item:get''hire:item:put''contract:collection:post''contract:item:get''contract:item:put'])]
  166.     private ?string $extraCostsCurrency null;
  167.     #[ORM\Column(type'string'nullabletrue)]
  168.     #[ApiProperty(iri'https://schema.org/extraCostsDescription')]
  169.     #[Assert\Type('string')]
  170.     #[Groups(['hire:collection:get''hire:collection:post''hire:item:get''hire:item:put''contract:collection:post''contract:item:get''contract:item:put'])]
  171.     private ?string $extraCostsDescription null;
  172.     #[ORM\Column(type'string'nullabletrue)]
  173.     #[ApiProperty(iri'https://schema.org/totalInvoice')]
  174.     #[Assert\Type('string')]
  175.     #[Groups(['hire:collection:get''hire:collection:post''hire:item:get''hire:item:put''contract:collection:post''contract:item:get''contract:item:put'])]
  176.     private ?string $totalInvoice null;
  177.     #[ORM\Column(type'string'nullabletrue)]
  178.     #[ApiProperty(iri'https://schema.org/totalInvoiceCurrency')]
  179.     #[Assert\Type('string')]
  180.     #[Groups(['hire:collection:get''hire:collection:post''hire:item:get''hire:item:put''contract:collection:post''contract:item:get''contract:item:put'])]
  181.     private ?string $totalInvoiceCurrency null;
  182.     #[ORM\Column(type'string'nullabletrue)]
  183.     #[ApiProperty(iri'https://schema.org/invoiceStatus')]
  184.     #[Assert\Type('string')]
  185.     #[Groups(['hire:collection:get''hire:collection:post''hire:item:get''hire:item:put''contract:collection:post''contract:item:get''contract:item:put'])]
  186.     private ?string $invoiceStatus null;
  187.     #[ORM\Column(type'boolean'nullabletrue)]
  188.     #[ApiProperty(iri'https://schema.org/bunker')]
  189.     #[Groups(['hire:collection:get''hire:collection:post''hire:item:get''hire:item:put''contract:collection:post''contract:item:get''contract:item:put'])]
  190.     private ?bool $bunker false;
  191.     #[ORM\Column(type'boolean'nullabletrue)]
  192.     #[ApiProperty(iri'https://schema.org/finalHire')]
  193.     #[Groups(['hire:collection:get''hire:collection:post''hire:item:get''hire:item:put''contract:collection:post''contract:item:get''contract:item:put'])]
  194.     private ?bool $finalHire false;
  195.     #[ORM\ManyToOne(targetEntity'App\Entity\Contract'inversedBy'hires')]
  196.     #[ORM\JoinColumn(nullabletrue)]
  197.     #[ApiProperty(iri'https://schema.org/Contract')]
  198.     #[Groups(['hire:collection:get''hire:collection:post''hire:item:get''hire:item:put''contract:collection:post''contract:item:get''contract:item:put'])]
  199.     #[MaxDepth(1)]
  200.     private ?Contract $contract null;
  201.     public function __construct()
  202.     {
  203.         $this->id Uuid::uuid4();
  204.     }
  205.     public function getId(): ?UuidInterface
  206.     {
  207.         return $this->id;
  208.     }
  209.     public function getHireBegin(): ?\DateTimeInterface
  210.     {
  211.         return $this->hireBegin;
  212.     }
  213.     public function setHireBegin(?\DateTimeInterface $hireBegin): void
  214.     {
  215.         $this->hireBegin $hireBegin;
  216.     }
  217.     public function getHireBeginDate(): ?string
  218.     {
  219.         return $this->hireBegin $this->hireBegin->format('Y-m-d') : null;
  220.     }
  221.     public function getHireBeginTime(): ?string
  222.     {
  223.         return $this->hireBegin $this->hireBegin->format('H:i') : null;
  224.     }
  225.     public function getHireEnd(): ?\DateTimeInterface
  226.     {
  227.         return $this->hireEnd;
  228.     }
  229.     public function setHireEnd(?\DateTimeInterface $hireEnd): void
  230.     {
  231.         $this->hireEnd $hireEnd;
  232.     }
  233.     public function getHireEndDate(): ?string
  234.     {
  235.         return $this->hireEnd $this->hireEnd->format('Y-m-d') : null;
  236.     }
  237.     public function getHireEndTime(): ?string
  238.     {
  239.         return $this->hireEnd $this->hireEnd->format('H:i') : null;
  240.     }
  241.     public function getFuelType(): ?string
  242.     {
  243.         return $this->fuelType;
  244.     }
  245.     public function setFuelType(?string $fuelType): void
  246.     {
  247.         $this->fuelType $fuelType;
  248.     }
  249.     public function getFuelType2(): ?string
  250.     {
  251.         return $this->fuelType2;
  252.     }
  253.     public function setFuelType2(?string $fuelType2): void
  254.     {
  255.         $this->fuelType2 $fuelType2;
  256.     }
  257.     public function getFuelType3(): ?string
  258.     {
  259.         return $this->fuelType3;
  260.     }
  261.     public function setFuelType3(?string $fuelType3): void
  262.     {
  263.         $this->fuelType3 $fuelType3;
  264.     }
  265.     public function getPrice(): ?string
  266.     {
  267.         return $this->price;
  268.     }
  269.     public function setPrice(?string $price): void
  270.     {
  271.         $this->price $price;
  272.     }
  273.     
  274.     public function getPrice2(): ?string
  275.     {
  276.         return $this->price2;
  277.     }
  278.     public function setPrice2(?string $price2): void
  279.     {
  280.         $this->price2 $price2;
  281.     }
  282.     
  283.     public function getPrice3(): ?string
  284.     {
  285.         return $this->price3;
  286.     }
  287.     public function setPrice3(?string $price3): void
  288.     {
  289.         $this->price3 $price3;
  290.     }
  291.     
  292.     public function getPriceCurrency(): ?string
  293.     {
  294.         return $this->priceCurrency;
  295.     }
  296.     public function setPriceCurrency(?string $priceCurrency): void
  297.     {
  298.         $this->priceCurrency $priceCurrency;
  299.     }
  300.     public function getPriceCurrency2(): ?string
  301.     {
  302.         return $this->priceCurrency2;
  303.     }
  304.     public function setPriceCurrency2(?string $priceCurrency2): void
  305.     {
  306.         $this->priceCurrency2 $priceCurrency2;
  307.     }
  308.     
  309.     public function getPriceCurrency3(): ?string
  310.     {
  311.         return $this->priceCurrency3;
  312.     }
  313.     public function setPriceCurrency3(?string $priceCurrency3): void
  314.     {
  315.         $this->priceCurrency3 $priceCurrency3;
  316.     }
  317.     public function getMultiFuel(): ?bool
  318.     {
  319.         return $this->multiFuel;
  320.     }
  321.     public function setMultiFuel(?bool $multiFuel): void
  322.     {
  323.         $this->multiFuel $multiFuel;
  324.     }
  325.     
  326.     public function setOffHireBegin(?\DateTimeInterface $offHireBegin): void
  327.     {
  328.         $this->offHireBegin $offHireBegin;
  329.     }
  330.     public function getOffHireBegin(): ?\DateTimeInterface
  331.     {
  332.         return $this->offHireBegin;
  333.     }
  334.     public function getOffHireBeginDate(): ?string
  335.     {
  336.         return $this->offHireBegin $this->offHireBegin->format('Y-m-d') : null;
  337.     }
  338.     public function getOffHireBeginTime(): ?string
  339.     {
  340.         return $this->offHireBegin $this->offHireBegin->format('H:i') : null;
  341.     }
  342.     public function setOffHireEnd(?\DateTimeInterface $offHireEnd): void
  343.     {
  344.         $this->offHireEnd $offHireEnd;
  345.     }
  346.     public function getOffHireEnd(): ?\DateTimeInterface
  347.     {
  348.         return $this->offHireEnd;
  349.     }
  350.     public function getOffHireEndDate(): ?string
  351.     {
  352.         return $this->offHireEnd $this->offHireEnd->format('Y-m-d') : null;
  353.     }
  354.     public function getOffHireEndTime(): ?string
  355.     {
  356.         return $this->offHireEnd $this->offHireEnd->format('H:i') : null;
  357.     }
  358.     public function getOffHireCost(): ?string
  359.     {
  360.         return $this->offHireCost;
  361.     }
  362.     public function setOffHireCost(?string $offHireCost): void
  363.     {
  364.         $this->offHireCost $offHireCost;
  365.     }
  366.     public function getOffHireCostCurrency(): ?string
  367.     {
  368.         return $this->offHireCostCurrency;
  369.     }
  370.     public function setOffHireCostCurrency(?string $offHireCostCurrency): void
  371.     {
  372.         $this->offHireCostCurrency $offHireCostCurrency;
  373.     }
  374.     public function getAddressCommission(): ?string
  375.     {
  376.         return $this->addressCommission;
  377.     }
  378.     public function setAddressCommission(?string $addressCommission): void
  379.     {
  380.         $this->addressCommission $addressCommission;
  381.     }
  382.     public function getExtraCosts(): ?string
  383.     {
  384.         return $this->extraCosts;
  385.     }
  386.     public function setExtraCosts(?string $extraCosts): void
  387.     {
  388.         $this->extraCosts $extraCosts;
  389.     }
  390.     public function getExtraCostsCurrency(): ?string
  391.     {
  392.         return $this->extraCostsCurrency;
  393.     }
  394.     public function setExtraCostsCurrency(?string $extraCostsCurrency): void
  395.     {
  396.         $this->extraCostsCurrency $extraCostsCurrency;
  397.     }
  398.     public function getExtraCostsDescription(): ?string
  399.     {
  400.         return $this->extraCostsDescription;
  401.     }
  402.     public function setExtraCostsDescription(?string $extraCostsDescription): void
  403.     {
  404.         $this->extraCostsDescription $extraCostsDescription;
  405.     }
  406.     public function getTotalInvoice(): ?string
  407.     {
  408.         return $this->totalInvoice;
  409.     }
  410.     public function setTotalInvoice(?string $totalInvoice): void
  411.     {
  412.         $this->totalInvoice $totalInvoice;
  413.     }
  414.     public function getTotalInvoiceCurrency(): ?string
  415.     {
  416.         return $this->totalInvoiceCurrency;
  417.     }
  418.     public function setTotalInvoiceCurrency(?string $totalInvoiceCurrency): void
  419.     {
  420.         $this->totalInvoiceCurrency $totalInvoiceCurrency;
  421.     }
  422.     public function getInvoiceStatus(): ?string
  423.     {
  424.         return $this->invoiceStatus;
  425.     }
  426.     public function setInvoiceStatus(?string $invoiceStatus): void
  427.     {
  428.         $this->invoiceStatus $invoiceStatus;
  429.     }
  430.     public function getBunker(): ?bool
  431.     {
  432.         return $this->bunker;
  433.     }
  434.     public function setBunker(?bool $bunker): void
  435.     {
  436.         $this->bunker $bunker;
  437.     }
  438.     public function getFinalHire(): ?bool
  439.     {
  440.         return $this->finalHire;
  441.     }
  442.     public function setFinalHire(?bool $finalHire): void
  443.     {
  444.         $this->finalHire $finalHire;
  445.     }
  446.     public function setContract(?Contract $contract): void
  447.     {
  448.         $this->contract $contract;
  449.     }
  450.     public function getContract(): ?Contract
  451.     {
  452.         return $this->contract;
  453.     }
  454. }