src/Entity/Bus/Stop.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Bus;
  3. use App\Entity\Station;
  4. use App\Entity\User;
  5. use DateTime;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use JMS\Serializer\Annotation as JMS;
  8. /**
  9. * @ORM\Entity(repositoryClass="App\Repository\Bus\StopRepository")
  10. * @ORM\Table(name="bus_stop")
  11. */
  12. class Stop{
  13. /**
  14. * @ORM\Id
  15. * @ORM\GeneratedValue(strategy="AUTO")
  16. * @ORM\Column(type="integer")
  17. */
  18. private int $id;
  19. /**
  20. *
  21. * @ORM\ManyToOne(targetEntity="App\Entity\Station", cascade={"persist"})
  22. * @ORM\JoinColumns({
  23. * @ORM\JoinColumn(name="station_id", referencedColumnName="id")
  24. * })
  25. * @JMS\MaxDepth(1)
  26. */
  27. private ?Station $station = null;
  28. /**
  29. * @var Route
  30. *
  31. * @ORM\ManyToOne(targetEntity="App\Entity\Bus\Route")
  32. * @ORM\JoinColumns({
  33. * @ORM\JoinColumn(name="route_id", referencedColumnName="id")
  34. * })
  35. */
  36. private Route $route;
  37. /**
  38. * @ORM\Column(type="string")
  39. */
  40. private string $routeType;
  41. /**
  42. * @var User
  43. *
  44. * @ORM\ManyToOne(targetEntity="App\Entity\User")
  45. * @ORM\JoinColumns({
  46. * @ORM\JoinColumn(name="created_by", referencedColumnName="id")
  47. * })
  48. * @JMS\MaxDepth(0)
  49. */
  50. private ?User $createdBy = null;
  51. /**
  52. * @ORM\Column(type="datetime")
  53. */
  54. private datetime $createdAt;
  55. /**
  56. * @ORM\Column(type="datetime")
  57. */
  58. private $departureTime;
  59. /**
  60. * @ORM\Column(type="datetime")
  61. */
  62. private $eta;
  63. /**
  64. * @return int
  65. */
  66. public function getId(): int
  67. {
  68. return $this->id;
  69. }
  70. /**
  71. * @param int $id
  72. */
  73. public function setId(int $id): void
  74. {
  75. $this->id = $id;
  76. }
  77. /**
  78. * @return ?Station
  79. */
  80. public function getStation(): ?Station
  81. {
  82. return $this->station;
  83. }
  84. /**
  85. * @param ?Station $station
  86. */
  87. public function setStation(?Station $station): void
  88. {
  89. $this->station = $station;
  90. }
  91. /**
  92. * @return Route
  93. */
  94. public function getRoute(): Route
  95. {
  96. return $this->route;
  97. }
  98. /**
  99. * @param Route $route
  100. */
  101. public function setRoute(Route $route): void
  102. {
  103. $this->route = $route;
  104. }
  105. /**
  106. * @return User
  107. */
  108. public function getCreatedBy(): User
  109. {
  110. return $this->createdBy;
  111. }
  112. /**
  113. * @param User $createdBy
  114. */
  115. public function setCreatedBy(User $createdBy): void
  116. {
  117. $this->createdBy = $createdBy;
  118. }
  119. /**
  120. * @return DateTime
  121. */
  122. public function getCreatedAt(): DateTime
  123. {
  124. return $this->createdAt;
  125. }
  126. /**
  127. * @param DateTime $createdAt
  128. */
  129. public function setCreatedAt(DateTime $createdAt): void
  130. {
  131. $this->createdAt = $createdAt;
  132. }
  133. /**
  134. * @return mixed
  135. */
  136. public function getDepartureTime()
  137. {
  138. return $this->departureTime;
  139. }
  140. /**
  141. * @param mixed $departureTime
  142. */
  143. public function setDepartureTime($departureTime): void
  144. {
  145. $this->departureTime = $departureTime;
  146. }
  147. public function getRouteType(): string
  148. {
  149. return $this->routeType;
  150. }
  151. public function setRouteType(string $routeType): void
  152. {
  153. $this->routeType = $routeType;
  154. }
  155. /**
  156. * @return mixed
  157. */
  158. public function getEta()
  159. {
  160. return $this->eta;
  161. }
  162. /**
  163. * @param mixed $eta
  164. */
  165. public function setEta($eta): void
  166. {
  167. $this->eta = $eta;
  168. }
  169. public function __toString()
  170. {
  171. // TODO: Implement __toString() method.
  172. return $this->getStation()->getStationName();
  173. }
  174. }