2022-03-06 18:25:46 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Entity;
|
|
|
|
|
|
|
|
use App\Core\Entity\EntityInterface;
|
|
|
|
use App\Repository\EstablishmentRepository;
|
|
|
|
use Doctrine\Common\Collections\ArrayCollection;
|
|
|
|
use Doctrine\Common\Collections\Collection;
|
|
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ORM\Entity(repositoryClass=EstablishmentRepository::class)
|
|
|
|
*/
|
|
|
|
class Establishment implements EntityInterface
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @ORM\Id
|
|
|
|
* @ORM\GeneratedValue
|
|
|
|
* @ORM\Column(type="integer")
|
|
|
|
*/
|
|
|
|
private $id;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ORM\Column(type="string", length=255)
|
|
|
|
*/
|
|
|
|
private $name;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ORM\Column(type="string", length=255)
|
|
|
|
*/
|
|
|
|
private $address;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ORM\Column(type="string", length=10)
|
|
|
|
*/
|
|
|
|
private $zipCode;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ORM\Column(type="string", length=100)
|
|
|
|
*/
|
|
|
|
private $city;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ORM\OneToMany(targetEntity=Intervention::class, mappedBy="establishment")
|
|
|
|
*/
|
|
|
|
private $interventions;
|
|
|
|
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
$this->interventions = new ArrayCollection();
|
|
|
|
}
|
|
|
|
|
2022-03-06 19:12:11 +01:00
|
|
|
public function __toString()
|
|
|
|
{
|
|
|
|
return $this->getName();
|
|
|
|
}
|
|
|
|
|
2022-03-06 18:25:46 +01:00
|
|
|
public function getId(): ?int
|
|
|
|
{
|
|
|
|
return $this->id;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getName(): ?string
|
|
|
|
{
|
|
|
|
return $this->name;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setName(string $name): self
|
|
|
|
{
|
|
|
|
$this->name = $name;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getAddress(): ?string
|
|
|
|
{
|
|
|
|
return $this->address;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setAddress(string $address): self
|
|
|
|
{
|
|
|
|
$this->address = $address;
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return Collection<int, Intervention>
|
|
|
|
*/
|
|
|
|
public function getInterventions(): Collection
|
|
|
|
{
|
|
|
|
return $this->interventions;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function addIntervention(Intervention $intervention): self
|
|
|
|
{
|
|
|
|
if (!$this->interventions->contains($intervention)) {
|
|
|
|
$this->interventions[] = $intervention;
|
|
|
|
$intervention->setEstablishment($this);
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function removeIntervention(Intervention $intervention): self
|
|
|
|
{
|
|
|
|
if ($this->interventions->removeElement($intervention)) {
|
|
|
|
// set the owning side to null (unless already changed)
|
|
|
|
if ($intervention->getEstablishment() === $this) {
|
|
|
|
$intervention->setEstablishment(null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
}
|