src/Entity/Location.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\LocationRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8. * @ORM\Entity(repositoryClass=LocationRepository::class)
  9. */
  10. class Location
  11. {
  12. /**
  13. * @ORM\Id
  14. * @ORM\GeneratedValue
  15. * @ORM\Column(type="integer")
  16. */
  17. private $id;
  18. /**
  19. * @ORM\Column(type="string", length=255)
  20. */
  21. private $street;
  22. /**
  23. * @ORM\Column(type="string", length=7)
  24. */
  25. private $zipCode;
  26. /**
  27. * @ORM\Column(type="string", length=255)
  28. */
  29. private $city;
  30. /**
  31. * @ORM\OneToOne(targetEntity=Sejour::class, mappedBy="location", cascade={"persist", "remove"})
  32. */
  33. private $sejour;
  34. /**
  35. * @ORM\OneToMany(targetEntity=Contact::class, mappedBy="location")
  36. */
  37. private $contacts;
  38. /**
  39. * @ORM\OneToMany(targetEntity=Contact::class, mappedBy="location")
  40. */
  41. private $contactForFamilleAccueils;
  42. /**
  43. * @ORM\Column(type="string", length=20, nullable=true)
  44. */
  45. private $houseNumber;
  46. /**
  47. * @ORM\Column(type="float", nullable=true)
  48. */
  49. private $lat;
  50. /**
  51. * @ORM\Column(type="float", nullable=true)
  52. */
  53. private $lng;
  54. /**
  55. * @ORM\ManyToOne(targetEntity=Departement::class, inversedBy="locations")
  56. */
  57. private $departement;
  58. /**
  59. * @ORM\Column(type="string", length=75)
  60. */
  61. private $country;
  62. /**
  63. * @ORM\Column(type="string", length=255, nullable=true)
  64. */
  65. private $title;
  66. /**
  67. * @ORM\Column(type="string", length=20, nullable=true)
  68. */
  69. private $telephone;
  70. public function __construct()
  71. {
  72. $this->contacts = new ArrayCollection();
  73. $this->contactForFamilleAccueils = new ArrayCollection();
  74. $this->country = "France";
  75. }
  76. public function getId(): ?int
  77. {
  78. return $this->id;
  79. }
  80. public function getStreet(): ?string
  81. {
  82. return $this->street;
  83. }
  84. public function setStreet(string $street): self
  85. {
  86. $this->street = $street;
  87. return $this;
  88. }
  89. public function getZipCode(): ?string
  90. {
  91. return $this->zipCode;
  92. }
  93. public function setZipCode(string $zipCode): self
  94. {
  95. $this->zipCode = $zipCode;
  96. return $this;
  97. }
  98. public function getCity(): ?string
  99. {
  100. return $this->city;
  101. }
  102. public function setCity(string $city): self
  103. {
  104. $this->city = $city;
  105. return $this;
  106. }
  107. public function getSejour(): ?Sejour
  108. {
  109. return $this->sejour;
  110. }
  111. public function setSejour(?Sejour $sejour): self
  112. {
  113. // unset the owning side of the relation if necessary
  114. if ($sejour === null && $this->sejour !== null) {
  115. $this->sejour->setLocation(null);
  116. }
  117. // set the owning side of the relation if necessary
  118. if ($sejour !== null && $sejour->getLocation() !== $this) {
  119. $sejour->setLocation($this);
  120. }
  121. $this->sejour = $sejour;
  122. return $this;
  123. }
  124. /**
  125. * @return Collection|Contact[]
  126. */
  127. public function getContacts(): Collection
  128. {
  129. return $this->contacts;
  130. }
  131. public function addContact(Contact $contact): self
  132. {
  133. if (!$this->contacts->contains($contact)) {
  134. $this->contacts[] = $contact;
  135. $contact->setLocation($this);
  136. }
  137. return $this;
  138. }
  139. public function removeContact(Contact $contact): self
  140. {
  141. if ($this->contacts->removeElement($contact)) {
  142. // set the owning side to null (unless already changed)
  143. if ($contact->getLocation() === $this) {
  144. $contact->setLocation(null);
  145. }
  146. }
  147. return $this;
  148. }
  149. public function getContactForFamilleAccueils(): Collection
  150. {
  151. return $this->contactForFamilleAccueils;
  152. }
  153. public function addContactForFamilleAccueil(ContactForFamilleAccueil $contact): self
  154. {
  155. if (!$this->contactForFamilleAccueils->contains($contact)) {
  156. $this->contactForFamilleAccueils[] = $contact;
  157. $contact->setLocation($this);
  158. }
  159. return $this;
  160. }
  161. public function removeContactForFamilleAccueil(ContactForFamilleAccueil $contact): self
  162. {
  163. if ($this->contactForFamilleAccueils->removeElement($contact)) {
  164. // set the owning side to null (unless already changed)
  165. if ($contact->getLocation() === $this) {
  166. $contact->setLocation(null);
  167. }
  168. }
  169. return $this;
  170. }
  171. public function getHouseNumber(): ?string
  172. {
  173. return $this->houseNumber;
  174. }
  175. public function setHouseNumber(?string $houseNumber): self
  176. {
  177. $this->houseNumber = $houseNumber;
  178. return $this;
  179. }
  180. public function getLat(): ?float
  181. {
  182. return $this->lat;
  183. }
  184. public function setLat(?float $lat): self
  185. {
  186. $this->lat = $lat;
  187. return $this;
  188. }
  189. public function getLng(): ?float
  190. {
  191. return $this->lng;
  192. }
  193. public function setLng(?float $lng): self
  194. {
  195. $this->lng = $lng;
  196. return $this;
  197. }
  198. public function getDepartement(): ?Departement
  199. {
  200. return $this->departement;
  201. }
  202. public function setDepartement(?Departement $departement): self
  203. {
  204. $this->departement = $departement;
  205. return $this;
  206. }
  207. public function getCountry(): ?string
  208. {
  209. return $this->country;
  210. }
  211. public function setCountry(string $country): self
  212. {
  213. $this->country = $country;
  214. return $this;
  215. }
  216. public function getTitle(): ?string
  217. {
  218. return $this->title;
  219. }
  220. public function setTitle(?string $title): self
  221. {
  222. $this->title = $title;
  223. return $this;
  224. }
  225. public function getTelephone(): ?string
  226. {
  227. return $this->telephone;
  228. }
  229. public function setTelephone(?string $telephone): self
  230. {
  231. $this->telephone = $telephone;
  232. return $this;
  233. }
  234. }