City.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. <?php
  2. namespace AppBundle\Entity\Core;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Dunglas\ApiBundle\Annotation\Iri;
  5. use Symfony\Component\Serializer\Annotation\Groups;
  6. use Symfony\Component\Validator\Constraints as Assert;
  7. /**
  8. * A city or town.
  9. * Enum des villes existantes (en France, Suisse, Luxembourg, Belgique)
  10. *
  11. *
  12. * @Iri("http://schema.org/City")
  13. */
  14. #[ORM\Entity]
  15. class City
  16. {
  17. /**
  18. * @var int
  19. */
  20. #[ORM\Column(type: 'integer')]
  21. #[ORM\Id]
  22. #[ORM\GeneratedValue(strategy: 'AUTO')]
  23. #[Groups(['city'])]
  24. private $id;
  25. /**
  26. * @var string The name of the item.
  27. *
  28. * @Iri("https://schema.org/name")
  29. */
  30. #[ORM\Column(type: 'string')]
  31. #[Assert\Type(type: 'string')]
  32. #[Assert\NotNull]
  33. #[Groups(['city'])]
  34. private $name;
  35. /**
  36. * @var Department
  37. */
  38. #[ORM\ManyToOne(targetEntity: 'Department')]
  39. #[ORM\JoinColumn(nullable: false)]
  40. #[Groups(['city'])]
  41. private $department;
  42. /**
  43. * @var float
  44. */
  45. #[ORM\Column(type: 'float', nullable: true)]
  46. #[Assert\Type(type: 'float')]
  47. #[Groups(['city'])]
  48. private $latitude;
  49. /**
  50. * @var float
  51. */
  52. #[ORM\Column(type: 'float', nullable: true)]
  53. #[Assert\Type(type: 'float')]
  54. #[Groups(['city'])]
  55. private $longitude;
  56. /**
  57. * @var string
  58. */
  59. #[ORM\Column(type: 'string', length: 20, nullable: true)]
  60. #[Assert\Type(type: 'string')]
  61. #[Groups(['city'])]
  62. private $postalCode;
  63. /**
  64. * Sets id.
  65. *
  66. * @param int $id
  67. *
  68. * @return $this
  69. */
  70. public function setId($id)
  71. {
  72. $this->id = $id;
  73. return $this;
  74. }
  75. /**
  76. * Gets id.
  77. *
  78. * @return int
  79. */
  80. public function getId()
  81. {
  82. return $this->id;
  83. }
  84. /**
  85. * Sets name.
  86. *
  87. * @param string $name
  88. *
  89. * @return $this
  90. */
  91. public function setName($name)
  92. {
  93. $this->name = $name;
  94. return $this;
  95. }
  96. /**
  97. * Gets name.
  98. *
  99. * @return string
  100. */
  101. public function getName()
  102. {
  103. return $this->name;
  104. }
  105. /**
  106. * Sets department.
  107. *
  108. * @param Department $department
  109. *
  110. * @return $this
  111. */
  112. public function setDepartment(Department $department = null)
  113. {
  114. $this->department = $department;
  115. return $this;
  116. }
  117. /**
  118. * Gets department.
  119. *
  120. * @return Department
  121. */
  122. public function getDepartment()
  123. {
  124. return $this->department;
  125. }
  126. /**
  127. * Sets latitude.
  128. *
  129. * @param float $latitude
  130. *
  131. * @return $this
  132. */
  133. public function setLatitude($latitude)
  134. {
  135. $this->latitude = floatval($latitude);
  136. return $this;
  137. }
  138. /**
  139. * Gets latitude.
  140. *
  141. * @return float
  142. */
  143. public function getLatitude()
  144. {
  145. return $this->latitude;
  146. }
  147. /**
  148. * Sets longitude.
  149. *
  150. * @param float $longitude
  151. *
  152. * @return $this
  153. */
  154. public function setLongitude($longitude)
  155. {
  156. $this->longitude = floatval($longitude);
  157. return $this;
  158. }
  159. /**
  160. * Gets longitude.
  161. *
  162. * @return float
  163. */
  164. public function getLongitude()
  165. {
  166. return $this->longitude;
  167. }
  168. /**
  169. * Sets postalCode.
  170. *
  171. * @param string $postalCode
  172. *
  173. * @return $this
  174. */
  175. public function setPostalCode($postalCode)
  176. {
  177. $this->postalCode = $postalCode;
  178. return $this;
  179. }
  180. /**
  181. * Gets postalCode.
  182. *
  183. * @return string
  184. */
  185. public function getPostalCode()
  186. {
  187. return $this->postalCode;
  188. }
  189. }