src/Entity/Sede.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\SedeRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=SedeRepository::class)
  9.  * @ORM\Table(name="sede")
  10.  */
  11. class Sede
  12. {
  13.     /**
  14.      * @ORM\Id
  15.      * @ORM\GeneratedValue
  16.      * @ORM\Column(type="integer")
  17.      */
  18.     private $id;
  19.     /**
  20.      * @ORM\Column(type="string", length=100, nullable=true)
  21.      */
  22.     private $nombre;
  23.     /**
  24.      * @ORM\Column(type="string", length=500)
  25.      */
  26.     private $direccion;
  27.     /**
  28.      * @ORM\Column(type="string", length=100)
  29.      */
  30.     private $poblacion;
  31.     /**
  32.      * @ORM\Column(type="string", length=100)
  33.      */
  34.     private $provincia;
  35.     /**
  36.      * @ORM\Column(type="string", length=15)
  37.      */
  38.     private $telefono;
  39.     /**
  40.      * @ORM\OneToMany(targetEntity=NumeroSede::class, mappedBy="sede", orphanRemoval=true)
  41.      */
  42.     private $numeroSedes;
  43.     public function __construct()
  44.     {
  45.         $this->numeroSedes = new ArrayCollection();
  46.     }
  47.     public function __toString(): string
  48.     {
  49.         return $this->getString();
  50.     }
  51.     public function getString(): string
  52.     {
  53.         $string $this->getDireccion();
  54.         $string .= $this->getNombre() ? ' (' $this->getNombre() . ')' null;
  55.         return $string;
  56.     }
  57.     public function getId(): ?int
  58.     {
  59.         return $this->id;
  60.     }
  61.     public function getNombre(): ?string
  62.     {
  63.         return $this->nombre;
  64.     }
  65.     public function setNombre(?string $nombre): self
  66.     {
  67.         $this->nombre $nombre;
  68.         return $this;
  69.     }
  70.     public function getDireccion(): ?string
  71.     {
  72.         return $this->direccion;
  73.     }
  74.     public function setDireccion(string $direccion): self
  75.     {
  76.         $this->direccion $direccion;
  77.         return $this;
  78.     }
  79.     public function getPoblacion(): ?string
  80.     {
  81.         return $this->poblacion;
  82.     }
  83.     public function setPoblacion(string $poblacion): self
  84.     {
  85.         $this->poblacion $poblacion;
  86.         return $this;
  87.     }
  88.     public function getProvincia(): ?string
  89.     {
  90.         return $this->provincia;
  91.     }
  92.     public function setProvincia(string $provincia): self
  93.     {
  94.         $this->provincia $provincia;
  95.         return $this;
  96.     }
  97.     public function getTelefono(): ?string
  98.     {
  99.         return $this->telefono;
  100.     }
  101.     public function setTelefono(string $telefono): self
  102.     {
  103.         $this->telefono $telefono;
  104.         return $this;
  105.     }
  106.     /**
  107.      * @return Collection<int, NumeroSede>
  108.      */
  109.     public function getNumeroSedes(): Collection
  110.     {
  111.         return $this->numeroSedes;
  112.     }
  113.     public function addNumeroSede(NumeroSede $numeroSede): self
  114.     {
  115.         if (!$this->numeroSedes->contains($numeroSede)) {
  116.             $this->numeroSedes[] = $numeroSede;
  117.             $numeroSede->setSede($this);
  118.         }
  119.         return $this;
  120.     }
  121.     public function removeNumeroSede(NumeroSede $numeroSede): self
  122.     {
  123.         if ($this->numeroSedes->removeElement($numeroSede)) {
  124.             // set the owning side to null (unless already changed)
  125.             if ($numeroSede->getSede() === $this) {
  126.                 $numeroSede->setSede(null);
  127.             }
  128.         }
  129.         return $this;
  130.     }
  131. }