vendor/croisiland/common-bundle/src/Entity/Itinerary/ItineraryActivity.php line 15

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace Croisiland\CommonBundle\Entity\Itinerary;
  4. use Crea\ToolsBundle\Entity\LifecycleUserIdentifierTrait;
  5. use Croisiland\CommonBundle\Entity\Traits\ListOrderTrait;
  6. use Croisiland\CommonBundle\Repository\Itinerary\ItineraryActivityRepository;
  7. use Doctrine\ORM\Mapping as ORM;
  8. /**
  9. * @ORM\Entity(repositoryClass=ItineraryActivityRepository::class)
  10. */
  11. class ItineraryActivity implements ItineraryPartInterface
  12. {
  13. use ListOrderTrait;
  14. use LifecycleUserIdentifierTrait;
  15. /**
  16. * @ORM\Id
  17. *
  18. * @ORM\GeneratedValue
  19. *
  20. * @ORM\Column(type="integer")
  21. */
  22. private ?int $id = null;
  23. /**
  24. * @ORM\Column(type="integer", nullable=false)
  25. */
  26. private ?int $dayNumber = null;
  27. /**
  28. * Delta en jours par rapport à la date de départ de la croisière
  29. *
  30. * @ORM\Column(type="integer", nullable=true)
  31. */
  32. private ?int $dateDelta = null;
  33. /**
  34. * @ORM\Column(type="time", nullable=true)
  35. */
  36. private ?\DateTimeInterface $startTime = null;
  37. /**
  38. * @ORM\Column(type="time", nullable=true)
  39. */
  40. private ?\DateTimeInterface $endTime = null;
  41. /**
  42. * @ORM\ManyToOne(targetEntity=Itinerary::class, inversedBy="itineraryActivities")
  43. */
  44. private ?Itinerary $itinerary = null;
  45. /**
  46. * @ORM\ManyToOne(targetEntity=Activity::class, inversedBy="itineraryActivities")
  47. *
  48. * @ORM\JoinColumn(nullable=true)
  49. */
  50. private ?Activity $activity = null;
  51. public function getId(): ?int
  52. {
  53. return $this->id;
  54. }
  55. public function getDayNumber(): ?int
  56. {
  57. return $this->dayNumber;
  58. }
  59. public function setDayNumber(?int $dayNumber): self
  60. {
  61. $this->dayNumber = $dayNumber;
  62. return $this;
  63. }
  64. public function getDateDelta(): ?int
  65. {
  66. return $this->dateDelta;
  67. }
  68. public function setDateDelta(?int $dateDelta): self
  69. {
  70. $this->dateDelta = $dateDelta;
  71. return $this;
  72. }
  73. public function getStartTime(): ?\DateTimeInterface
  74. {
  75. return $this->startTime;
  76. }
  77. public function setStartTime(?\DateTimeInterface $startTime): self
  78. {
  79. $this->startTime = $startTime;
  80. return $this;
  81. }
  82. public function getEndTime(): ?\DateTimeInterface
  83. {
  84. return $this->endTime;
  85. }
  86. public function setEndTime(?\DateTimeInterface $endTime): self
  87. {
  88. $this->endTime = $endTime;
  89. return $this;
  90. }
  91. public function getItinerary(): ?Itinerary
  92. {
  93. return $this->itinerary;
  94. }
  95. public function setItinerary(?Itinerary $itinerary): self
  96. {
  97. $this->itinerary = $itinerary;
  98. return $this;
  99. }
  100. public function getActivity(): ?Activity
  101. {
  102. return $this->activity;
  103. }
  104. public function setActivity(?Activity $activity): self
  105. {
  106. $this->activity = $activity;
  107. return $this;
  108. }
  109. public function getStartTimeInSeconds(): ?int
  110. {
  111. if (null === $this->getStartTime()) {
  112. return null;
  113. }
  114. return ($this->getStartTime()->format('H') * 3600) + ($this->getStartTime()->format('i') * 60);
  115. }
  116. public function getEndTimeInSeconds(): ?int
  117. {
  118. if (null === $this->getEndTime()) {
  119. return null;
  120. }
  121. return ($this->getEndTime()->format('H') * 3600) + ($this->getEndTime()->format('i') * 60);
  122. }
  123. }