<?php
namespace App\Entity;
use App\Repository\LocationRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=LocationRepository::class)
*/
class Location
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $street;
/**
* @ORM\Column(type="string", length=7)
*/
private $zipCode;
/**
* @ORM\Column(type="string", length=255)
*/
private $city;
/**
* @ORM\OneToOne(targetEntity=Sejour::class, mappedBy="location", cascade={"persist", "remove"})
*/
private $sejour;
/**
* @ORM\OneToMany(targetEntity=Contact::class, mappedBy="location")
*/
private $contacts;
/**
* @ORM\OneToMany(targetEntity=Contact::class, mappedBy="location")
*/
private $contactForFamilleAccueils;
/**
* @ORM\Column(type="string", length=20, nullable=true)
*/
private $houseNumber;
/**
* @ORM\Column(type="float", nullable=true)
*/
private $lat;
/**
* @ORM\Column(type="float", nullable=true)
*/
private $lng;
/**
* @ORM\ManyToOne(targetEntity=Departement::class, inversedBy="locations")
*/
private $departement;
/**
* @ORM\Column(type="string", length=75)
*/
private $country;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $title;
/**
* @ORM\Column(type="string", length=20, nullable=true)
*/
private $telephone;
public function __construct()
{
$this->contacts = new ArrayCollection();
$this->contactForFamilleAccueils = new ArrayCollection();
$this->country = "France";
}
public function getId(): ?int
{
return $this->id;
}
public function getStreet(): ?string
{
return $this->street;
}
public function setStreet(string $street): self
{
$this->street = $street;
return $this;
}
public function getZipCode(): ?string
{
return $this->zipCode;
}
public function setZipCode(string $zipCode): self
{
$this->zipCode = $zipCode;
return $this;
}
public function getCity(): ?string
{
return $this->city;
}
public function setCity(string $city): self
{
$this->city = $city;
return $this;
}
public function getSejour(): ?Sejour
{
return $this->sejour;
}
public function setSejour(?Sejour $sejour): self
{
// unset the owning side of the relation if necessary
if ($sejour === null && $this->sejour !== null) {
$this->sejour->setLocation(null);
}
// set the owning side of the relation if necessary
if ($sejour !== null && $sejour->getLocation() !== $this) {
$sejour->setLocation($this);
}
$this->sejour = $sejour;
return $this;
}
/**
* @return Collection|Contact[]
*/
public function getContacts(): Collection
{
return $this->contacts;
}
public function addContact(Contact $contact): self
{
if (!$this->contacts->contains($contact)) {
$this->contacts[] = $contact;
$contact->setLocation($this);
}
return $this;
}
public function removeContact(Contact $contact): self
{
if ($this->contacts->removeElement($contact)) {
// set the owning side to null (unless already changed)
if ($contact->getLocation() === $this) {
$contact->setLocation(null);
}
}
return $this;
}
public function getContactForFamilleAccueils(): Collection
{
return $this->contactForFamilleAccueils;
}
public function addContactForFamilleAccueil(ContactForFamilleAccueil $contact): self
{
if (!$this->contactForFamilleAccueils->contains($contact)) {
$this->contactForFamilleAccueils[] = $contact;
$contact->setLocation($this);
}
return $this;
}
public function removeContactForFamilleAccueil(ContactForFamilleAccueil $contact): self
{
if ($this->contactForFamilleAccueils->removeElement($contact)) {
// set the owning side to null (unless already changed)
if ($contact->getLocation() === $this) {
$contact->setLocation(null);
}
}
return $this;
}
public function getHouseNumber(): ?string
{
return $this->houseNumber;
}
public function setHouseNumber(?string $houseNumber): self
{
$this->houseNumber = $houseNumber;
return $this;
}
public function getLat(): ?float
{
return $this->lat;
}
public function setLat(?float $lat): self
{
$this->lat = $lat;
return $this;
}
public function getLng(): ?float
{
return $this->lng;
}
public function setLng(?float $lng): self
{
$this->lng = $lng;
return $this;
}
public function getDepartement(): ?Departement
{
return $this->departement;
}
public function setDepartement(?Departement $departement): self
{
$this->departement = $departement;
return $this;
}
public function getCountry(): ?string
{
return $this->country;
}
public function setCountry(string $country): self
{
$this->country = $country;
return $this;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(?string $title): self
{
$this->title = $title;
return $this;
}
public function getTelephone(): ?string
{
return $this->telephone;
}
public function setTelephone(?string $telephone): self
{
$this->telephone = $telephone;
return $this;
}
}