src/Entity/Provincia.php line 19
- <?php
- namespace App\Entity;
- use Doctrine\Common\Collections\ArrayCollection;
- use Doctrine\Common\Collections\Collection;
- use Symfony\Component\Validator\Constraints as Assert;
- use Doctrine\ORM\Mapping as ORM;
- use Knp\DoctrineBehaviors\Contract\Entity\TranslatableInterface;
- use Knp\DoctrineBehaviors\Model\Translatable\TranslatableTrait;
- /**
- * Provincia
- *
- * @ORM\Table(name="provincia")
- * @ORM\Entity(repositoryClass="App\Repository\ProvinciaRepository")
- */
- class Provincia implements TranslatableInterface
- {
- use TranslatableTrait;
- /**
- * @var integer
- *
- * @ORM\Column(name="id", type="integer")
- * @ORM\Id
- * @ORM\GeneratedValue(strategy="AUTO")
- */
- private $id;
- /**
- * @var string
- *
- * @ORM\Column(name="nombre", type="string", length=100)
- */
- private $nombre;
- /**
- * @var string
- *
- * @ORM\ManyToOne(targetEntity="Imagen")
- */
- protected $imagenCabecera;
- /**
- * @var string
- *
- * @ORM\ManyToOne(targetEntity="Imagen")
- */
- protected $imagenBanner;
- /**
- * @var string
- *
- * @ORM\Column(name="gastos", type="string", length=255)
- */
- private $gastos;
- /**
- * @var integer
- *
- * @ORM\Column(name="peso", type="integer", nullable=false)
- * @ORM\OrderBy({"peso" = "DESC"})
- */
- private $peso=0;
- /**
- * @ORM\OneToMany(targetEntity="Localidad", mappedBy="provincia", fetch="EAGER")
- * @ORM\OrderBy({"peso" = "DESC"})
- */
- private $localidades;
- /**
- * @ORM\OneToMany(targetEntity="Oficina", mappedBy="provincia")
- * @ORM\OrderBy({"peso" = "DESC"})
- */
- private $oficinas;
- public function __call($method, $args)
- {
- //return $this->proxyCurrentLocaleTranslation($method, $arguments);
- if (!method_exists(self::getTranslationEntityClass(), $method)) {
- $method = 'get'. ucfirst($method);
- }
- return $this->proxyCurrentLocaleTranslation($method, $args);
- }
- public function __construct() {
- $this->traducciones = new ArrayCollection();
- $this->localidades = new ArrayCollection();
- $this->oficinas = new ArrayCollection();
- }
- /**
- * Get id
- *
- * @return integer
- */
- public function getId()
- {
- return $this->id;
- }
- /**
- * Set nombre
- *
- * @param string $nombre
- * @return Provincia
- */
- public function setNombre($nombre)
- {
- $this->nombre = $nombre;
- return $this;
- }
- /**
- * Get nombre
- *
- * @return string
- */
- public function getNombre()
- {
- return $this->nombre;
- }
- /**
- * Set gastos
- *
- * @param string $gastos
- * @return Provincia
- */
- public function setGastos($gastos)
- {
- $this->gastos = $gastos;
- return $this;
- }
- /**
- * Get gastos
- *
- * @return float
- */
- public function getGastos()
- {
- return $this->gastos;
- }
- public function __toString(){
- return $this->nombre;
- }
- /**
- * Set peso
- *
- * @param integer $peso
- * @return Oficina
- */
- public function setPeso($peso)
- {
- $this->peso=$peso;
- return $this;
- }
- /**
- * Get peso
- *
- * @return integer
- */
- public function getPeso()
- {
- return $this->peso;
- }
- /**
- * Set localidades
- *
- * @param ArrayCollection $localidades
- * @return Oficina
- */
- public function setLocalidades($localidades)
- {
- $this->localidades=$localidades;
- return $this;
- }
- /**
- * Get localidades
- *
- * @return ArrayCollection
- */
- public function getLocalidades()
- {
- return $this->localidades;
- }
- /**
- * Set oficinas
- *
- * @param ArrayCollection $oficinas
- * @return ArrayCollection
- */
- public function setOficinas($oficinas)
- {
- $this->oficinas=$oficinas;
- return $this;
- }
- /**
- * Get oficinas
- *
- * @return integer
- */
- public function getOficinas()
- {
- return $this->oficinas;
- }
- public function getImagenCabecera(): ?Imagen
- {
- return $this->imagenCabecera;
- }
- public function setImagenCabecera(?Imagen $imagenCabecera): self
- {
- $this->imagenCabecera = $imagenCabecera;
- return $this;
- }
- public function getImagenBanner(): ?Imagen
- {
- return $this->imagenBanner;
- }
- public function setImagenBanner(?Imagen $imagenBanner): self
- {
- $this->imagenBanner = $imagenBanner;
- return $this;
- }
- public function addLocalidade(Localidad $localidade): self
- {
- if (!$this->localidades->contains($localidade)) {
- $this->localidades->add($localidade);
- $localidade->setProvincia($this);
- }
- return $this;
- }
- public function removeLocalidade(Localidad $localidade): self
- {
- if ($this->localidades->removeElement($localidade)) {
- // set the owning side to null (unless already changed)
- if ($localidade->getProvincia() === $this) {
- $localidade->setProvincia(null);
- }
- }
- return $this;
- }
- public function addOficina(Oficina $oficina): self
- {
- if (!$this->oficinas->contains($oficina)) {
- $this->oficinas->add($oficina);
- $oficina->setProvincia($this);
- }
- return $this;
- }
- public function removeOficina(Oficina $oficina): self
- {
- if ($this->oficinas->removeElement($oficina)) {
- // set the owning side to null (unless already changed)
- if ($oficina->getProvincia() === $this) {
- $oficina->setProvincia(null);
- }
- }
- return $this;
- }
- }