src/Entity/Divisa.php line 19
- <?php
- namespace App\Entity;
- use Doctrine\Common\Collections\ArrayCollection;
- use Doctrine\Common\Collections\Collection;
- use Doctrine\ORM\Mapping as ORM;
- use Symfony\Component\Validator\Constraints as Assert;
- use Knp\DoctrineBehaviors\Contract\Entity\TranslatableInterface;
- use Knp\DoctrineBehaviors\Model\Translatable\TranslatableTrait;
- /**
- * Divisa
- *
- * @ORM\Table(name="divisa")
- * @ORM\Entity(repositoryClass="App\Repository\DivisaRepository")
- */
- class Divisa 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="shortName", type="string", length=255)
- */
- private $shortName;
- // /**
- // * @var string
- // *
- // * @ORM\Column(name="altBanner", type="string", length=255, nullable=true)
- // *
- // */
- // private $altBanner;
- /**
- * @var string
- *
- * @ORM\Column(name="altFlag", type="string", length=255, nullable=true)
- *
- */
- private $altFlag;
- /**
- * @var integer
- *
- * @ORM\Column(name="peso", type="integer", length=255)
- */
- private $peso=0;
- /**
- * @var string
- *
- * @ORM\Column(name="simbolo", type="string", length=5, nullable=true)
- */
- private $simbolo;
- /**
- * @var string
- *
- * @ORM\Column(name="title", type="string", length=255)
- */
- private $title;
- /**
- * @var boolean
- *
- * @ORM\Column(name="bloqueado", type="boolean")
- */
- private $bloqueado=0;
- /**
- * @var boolean
- *
- * @ORM\Column(name="maestro", type="boolean")
- */
- private $maestro=0;
- /**
- * @var boolean
- *
- * @ORM\Column(name="virtual", type="boolean")
- */
- private $virtual=0;
- /**
- * @var boolean
- *
- * @ORM\Column(name="visible", type="boolean")
- */
- private $visible=0;
- /**
- * @ORM\OneToMany(targetEntity="Cotizaciones", mappedBy="shortName", cascade={"remove"})
- * @ORM\OrderBy({"dia" = "DESC"})
- */
- private $cotizaciones;
- /**
- * @var string
- *
- * @ORM\Column(name="redondeoMinimo", type="float")
- */
- private $redondeoMinimo=1;
- /**
- * @var string
- *
- * @ORM\Column(name="numDecimales", type="integer")
- */
- private $numDecimales=0;
- /**
- * @var string
- *
- * @ORM\Column(name="url_organismo_oficial", type="string", nullable=true)
- */
- private $urlOrganismoOficial=NULL;
- /**
- * @var string
- *
- * @ORM\ManyToOne(targetEntity="Imagen")
- */
- protected $imagen;
- /**
- * @var string
- *
- * @ORM\ManyToOne(targetEntity="Imagen")
- */
- protected $banner;
- /**
- * @ORM\OneToMany(targetEntity="DivisaConversion", mappedBy="divisaOrigen", orphanRemoval=true)
- */
- private $origenConversiones;
- /**
- * @ORM\OneToMany(targetEntity="DivisaConversion", mappedBy="divisaDestino", orphanRemoval=true)
- */
- private $destinoConversiones;
- /**
- * @var integer
- *
- * @ORM\Column(name="compraMinima", type="integer", length=255)
- */
- private $compraMinima=0;
- /**
- * @ORM\ManyToMany(targetEntity="Cupon", mappedBy="divisas")
- *
- */
- protected $cupones;
- private $translations2;
- public function __call($method, $args)
- {
- if (!method_exists(self::getTranslationEntityClass(), $method)) {
- $method = 'get'. ucfirst($method);
- }
- return $this->proxyCurrentLocaleTranslation($method, $args);
- }
- public function __toString() {
- return $this->shortName;
- }
- public function __construct() {
- $this->traducciones = new ArrayCollection();
- $this->cotizaciones = new ArrayCollection();
- $this->origenConversiones = new ArrayCollection();
- $this->destinoConversiones = new ArrayCollection();
- $this->cupones = new ArrayCollection();
- }
- public function addCotizacion(Cotizaciones $cotizaciones)
- {
- $this->cotizaciones[] = $cotizaciones;
- }
- public function getCotizaciones()
- {
- return $this->cotizaciones;
- }
- /**
- * Get id
- *
- * @return integer
- */
- public function getId()
- {
- return $this->id;
- }
- // /**
- // * Get altBanner
- // *
- // * @return string
- // */
- // public function getAltBanner(){
- // return $this->altBanner;
- // }
- //
- // /**
- // * Set altBanner
- // * @param string $altBanner
- // * @return Divisa
- // */
- //
- // public function setAltBAnner($altBAnner){
- //
- // $this->altBanner = $altBAnner;
- //
- // return $this;
- //
- // }
- /**
- * Get altFlag
- *
- * @return string
- */
- public function getAltFlag(){
- return $this->altFlag;
- }
- /**
- * Set altFlag
- * @param string $altFlag
- * @return Divisa
- */
- public function setAltFlag($altFlag){
- $this->altFlag = $altFlag;
- return $this;
- }
- /**
- * Set shortName
- *
- * @param string $shortName
- * @return Divisa
- */
- public function setShortName($shortName)
- {
- $this->shortName = $shortName;
- return $this;
- }
- /**
- * Get shortName
- *
- * @return string
- */
- public function getShortName()
- {
- return $this->shortName;
- }
- /**
- * Set simbolo
- *
- * @param string $simbolo
- * @return Divisa
- */
- public function setSimbolo($simbolo)
- {
- $this->simbolo = $simbolo;
- return $this;
- }
- /**
- * Get maestro
- *
- * @return string
- */
- public function getMaestro()
- {
- return $this->maestro;
- }
- /**
- * Set maestro
- *
- * @param boolean $maestro
- * @return Divisa
- */
- public function setMaestro($maestro)
- {
- $this->maestro = $maestro;
- return $this;
- }
- /**
- * Get simbolo
- *
- * @return string
- */
- public function getSimbolo()
- {
- return $this->simbolo;
- }
- /**
- * Set title
- *
- * @param string $title
- * @return Divisa
- */
- public function setTitle($title)
- {
- $this->title = $title;
- return $this;
- }
- /**
- * Get title
- *
- * @return string
- */
- public function getTitle()
- {
- return $this->title;
- }
- /**
- * Set redondeoMinimo
- *
- * @param int $redondeoMinimo
- * @return Divisa
- */
- public function setRedondeoMinimo($redondeoMinimo)
- {
- $this->redondeoMinimo = $redondeoMinimo;
- return $this;
- }
- /**
- * Get redondeoMinimo
- *
- * @return int
- */
- public function getRedondeoMinimo()
- {
- return $this->redondeoMinimo;
- }
- /**
- * Set redondeoMinimo
- *
- * @param bool $redondeoMinimo
- * @return Divisa
- */
- public function setBloqueado($bloqueado)
- {
- $this->bloqueado = $bloqueado;
- return $this;
- }
- /**
- * Get bloqueado
- *
- * @return bool
- */
- public function getBloqueado()
- {
- return $this->bloqueado;
- }
- /**
- * Set redondeoMinimo
- *
- * @param bool $redondeoMinimo
- * @return Divisa
- */
- public function setVirtual($virtual)
- {
- $this->virtual = $virtual;
- return $this;
- }
- /**
- * Get virtual
- *
- * @return bool
- */
- public function getVirtual()
- {
- return $this->virtual;
- }
- /**
- * Set antigua
- *
- * @param bool $visible
- * @return Divisa
- */
- public function setVisible($visible)
- {
- $this->visible = $visible;
- return $this;
- }
- /**
- * Get urlOrganismoOficial
- *
- * @return bool
- */
- public function getUrlOrganismoOficial()
- {
- return $this->urlOrganismoOficial;
- }
- /**
- * Set urlOrganismoOficial
- *
- * @param bool $urlOrganismoOficial
- * @return Divisa
- */
- public function setUrlOrganismoOficial($urlOrganismoOficial)
- {
- $this->urlOrganismoOficial = $urlOrganismoOficial;
- return $this;
- }
- /**
- * Get visble
- *
- * @return bool
- */
- public function getVisible()
- {
- return $this->visible;
- }
- public function jsonSerialize()
- {
- return array(
- 'id' => $this->id,
- 'shortName'=> $this->shortName,
- 'nombreIngles'=> $this->nombreIngles,
- 'nombreEspanol'=> $this->nombreEspanol,
- 'redondeoMinimo' => $this->redondeoMinimo,
- 'cotizaciones' =>json_encode($this->cotizaciones),
- );
- }
- /**
- * Set traducciones
- *
- * @param ArrayColection $divisa
- * @return Divisa
- */
- public function setTraducciones($traducciones)
- {
- $this->traducciones=$traducciones;
- return $this;
- }
- /**
- * add traducciones
- *
- * @param DivisaIdioma $oficina
- * @return Divisa
- */
- public function addTraduccion(DivisaIdioma $traduccion)
- {
- $this->traducciones[]=$traduccion;
- return $this;
- }
- /**
- * add traducciones
- *
- * @param DivisaIdioma $oficina
- * @return Divisa
- */
- public function removeTraduccion(DivisaIdioma $traduccion)
- {
- return $this;
- }
- /**
- * Get traducciones
- *
- * @return ArrayCollection
- */
- public function getTraducciones()
- {
- return $this->traducciones;
- }
- /**
- * Get traducciones
- *
- * @return traducciones
- */
- /* public function getSlug($locale)
- {
- foreach($this->traducciones as $td){
- if($td->getIdioma()->getUrl()==$locale){
- return $td->getSlug();
- }
- }
- return false;
- }*/
- public function getSlug($locale=null)
- {
- if (null === $locale) {
- $locale = $this->getCurrentLocale();
- }
- return $this->translate($locale)->getSlug();
- }
- /**
- * Get traducciones
- *
- * @return traducciones
- */
- public function getNombreLocal($locale)
- {
- foreach($this->traducciones as $td){
- if($td->getIdioma()->getUrl()==$locale){
- return $td->getNombre();
- }
- }
- return false;
- }
- /**
- * Set peso
- *
- * @param integer $peso
- * @return Divisa
- */
- public function setPeso($peso)
- {
- $this->peso = $peso;
- return $this;
- }
- /**
- * Get peso
- *
- * @return integer
- */
- public function getPeso()
- {
- return $this->peso;
- }
- /**
- * Set numDecimales
- *
- * @param integer $numDecimales
- * @return Divisa
- */
- public function setNumDecimales($numDecimales)
- {
- $this->numDecimales = $numDecimales;
- return $this;
- }
- /**
- * Get numDecimales
- *
- * @return integer
- */
- public function getNumDecimales()
- {
- return $this->numDecimales;
- }
- /**
- * Set compraMinima
- *
- * @param integer $compraMinima
- * @return Divisa
- */
- public function setCompraMinima($compraMinima)
- {
- $this->compraMinima = $compraMinima;
- return $this;
- }
- /**
- * Get compraMinima
- *
- * @return integer
- */
- public function getCompraMinima()
- {
- return $this->compraMinima;
- }
- public function isBloqueado(): ?bool
- {
- return $this->bloqueado;
- }
- public function isMaestro(): ?bool
- {
- return $this->maestro;
- }
- public function isVirtual(): ?bool
- {
- return $this->virtual;
- }
- public function isVisible(): ?bool
- {
- return $this->visible;
- }
- public function addCotizacione(Cotizaciones $cotizacione): self
- {
- if (!$this->cotizaciones->contains($cotizacione)) {
- $this->cotizaciones->add($cotizacione);
- $cotizacione->setShortName($this);
- }
- return $this;
- }
- public function removeCotizacione(Cotizaciones $cotizacione): self
- {
- if ($this->cotizaciones->removeElement($cotizacione)) {
- // set the owning side to null (unless already changed)
- if ($cotizacione->getShortName() === $this) {
- $cotizacione->setShortName(null);
- }
- }
- return $this;
- }
- public function getImagen(): ?Imagen
- {
- return $this->imagen;
- }
- public function setImagen(?Imagen $imagen): self
- {
- $this->imagen = $imagen;
- return $this;
- }
- public function getBanner(): ?Imagen
- {
- return $this->banner;
- }
- public function setBanner(?Imagen $banner): self
- {
- $this->banner = $banner;
- return $this;
- }
- /**
- * @return Collection<int, DivisaConversion>
- */
- public function getOrigenConversiones(): Collection
- {
- return $this->origenConversiones;
- }
- public function addOrigenConversione(DivisaConversion $origenConversione): self
- {
- if (!$this->origenConversiones->contains($origenConversione)) {
- $this->origenConversiones->add($origenConversione);
- $origenConversione->setDivisaOrigen($this);
- }
- return $this;
- }
- public function removeOrigenConversione(DivisaConversion $origenConversione): self
- {
- if ($this->origenConversiones->removeElement($origenConversione)) {
- // set the owning side to null (unless already changed)
- if ($origenConversione->getDivisaOrigen() === $this) {
- $origenConversione->setDivisaOrigen(null);
- }
- }
- return $this;
- }
- /**
- * @return Collection<int, DivisaConversion>
- */
- public function getDestinoConversiones(): Collection
- {
- return $this->destinoConversiones;
- }
- public function addDestinoConversione(DivisaConversion $destinoConversione): self
- {
- if (!$this->destinoConversiones->contains($destinoConversione)) {
- $this->destinoConversiones->add($destinoConversione);
- $destinoConversione->setDivisaDestino($this);
- }
- return $this;
- }
- public function removeDestinoConversione(DivisaConversion $destinoConversione): self
- {
- if ($this->destinoConversiones->removeElement($destinoConversione)) {
- // set the owning side to null (unless already changed)
- if ($destinoConversione->getDivisaDestino() === $this) {
- $destinoConversione->setDivisaDestino(null);
- }
- }
- return $this;
- }
- public function getCupones()
- {
- return $this->cupones;
- }
- public function getNombre(): ?string
- {
- return $this->translate(null, false)->getNombre();
- }
- }