src/AppBundle/Entity/Banner.php line 22
<?php
namespace AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\HttpFoundation\File\File;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
use Symfony\Component\Validator\Constraints as Assert;
/**
* Banner
*
* @ORM\Table(name="banner")
* @ORM\Entity(repositoryClass="AppBundle\Repository\BannerRepository")
* @ORM\HasLifecycleCallbacks()
* @Vich\Uploadable
* @Assert\GroupSequence({"Banner", "Strict"})
*/
class Banner
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var int
*
* @ORM\Column(name="orden", type="smallint")
*/
private $orden = 0;
/**
* @var string (link)
*
* @ORM\Column(name="url_publica", type="string", length=255, nullable=true)
*/
private $urlPublica;
/**
* @var string (link)
*
* @ORM\Column(name="url_privada", type="string", length=255, nullable=true)
*/
private $urlPrivada;
/**
* @var string
*
* @ORM\Column(name="imagen_es", type="string", length=255, nullable=true)
*/
private $imagenEs;
/**
* @Vich\UploadableField(mapping="banner", fileNameProperty="imagen_es")
* @Assert\File(maxSize = "2M")
* @var File
*/
private $imagenArchivoEs;
/**
* @var string
*
* @ORM\Column(name="imagen_en", type="string", length=255, nullable=true)
*/
private $imagenEn;
/**
* @Vich\UploadableField(mapping="banner", fileNameProperty="imagen_en")
* @Assert\File(maxSize = "2M")
* @var File
*/
private $imagenArchivoEn;
/**
* @var string (link)
*
* @ORM\Column(name="texto_alt", type="string", length=255, nullable=true)
*/
private $textoAlt;
/**
* @ORM\Column(name="updated_at", type="datetime", nullable=true)
* @var \DateTime
*/
private $updatedAt;
/**
* Muchas imagenes/video tiene un bloque.
* @ORM\ManyToOne(targetEntity="BloqueBanner", inversedBy="banners")
* @ORM\JoinColumn(name="bloque_id", referencedColumnName="id")
*/
private $bloque;
/**
* @var string (link)
*
* @ORM\Column(name="texto_analitycs", type="string", length=255, nullable=true)
*/
private $textoAnalitycs;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set orden
*
* @param integer $orden
*
* @return Banner
*/
public function setOrden($orden)
{
$this->orden = $orden;
return $this;
}
/**
* Get orden
*
* @return integer
*/
public function getOrden()
{
return $this->orden;
}
/**
* Set imagenEs
*
* @param string $imagenEs
*
* @return Banner
*/
public function setImagenEs($imagenEs)
{
$this->imagenEs = $imagenEs;
if ($imagenEs) {
// It is required that at least one field changes if you are using doctrine
// otherwise the event listeners won't be called and the file is lost
$this->updatedAt = new \DateTimeImmutable();
}
return $this;
}
/**
* Get imagenEs
*
* @return string
*/
public function getImagenEs()
{
return $this->imagenEs;
}
/**
* Set imagenEn
*
* @param string $imagenEn
*
* @return Banner
*/
public function setImagenEn($imagenEn)
{
$this->imagenEn = $imagenEn;
if ($imagenEn) {
// It is required that at least one field changes if you are using doctrine
// otherwise the event listeners won't be called and the file is lost
$this->updatedAt = new \DateTimeImmutable();
}
return $this;
}
/**
* Get imagenEn
*
* @return string
*/
public function getImagenEn()
{
return $this->imagenEn;
}
/**
* @return File|null
*/
public function getImagenArchivoEs()
{
return $this->imagenArchivoEs;
}
/**
* @return File|null
*/
public function getImagenArchivoEn()
{
return $this->imagenArchivoEn;
}
/**
* Set updatedAt
*
* @param \DateTime $updatedAt
*
* @return Banner
*/
public function setUpdatedAt($updatedAt)
{
$this->updatedAt = $updatedAt;
return $this;
}
/**
* Get updatedAt
*
* @return \DateTime
*/
public function getUpdatedAt()
{
return $this->updatedAt;
}
/**
* Set bloque
*
* @param \AppBundle\Entity\BloqueBanner $bloque
*
* @return Banner
*/
public function setBloque(\AppBundle\Entity\BloqueBanner $bloque = null)
{
$this->bloque = $bloque;
return $this;
}
/**
* Get bloque
*
* @return \AppBundle\Entity\BloqueBanner
*/
public function getBloque()
{
return $this->bloque;
}
/**
* @param File|\Symfony\Component\HttpFoundation\File\UploadedFile $imagen
* @return Banner
*/
public function setImagenArchivoEs(File $imagen = null)
{
$this->imagenArchivoEs = $imagen;
if ($imagen) {
// It is required that at least one field changes if you are using doctrine
// otherwise the event listeners won't be called and the file is lost
$this->updatedAt = new \DateTimeImmutable();
}
return $this;
}
/**
* @param File|\Symfony\Component\HttpFoundation\File\UploadedFile $imagen
* @return Banner
*/
public function setImagenArchivoEn(File $imagen = null)
{
$this->imagenArchivoEn = $imagen;
if ($imagen) {
// It is required that at least one field changes if you are using doctrine
// otherwise the event listeners won't be called and the file is lost
$this->updatedAt = new \DateTimeImmutable();
}
return $this;
}
/**
* Set urlPublica
*
* @param string $urlPublica
*
* @return Banner
*/
public function setUrlPublica($urlPublica)
{
$this->urlPublica = $urlPublica;
return $this;
}
/**
* Get urlPublica
*
* @return string
*/
public function getUrlPublica()
{
return $this->urlPublica;
}
/**
* Set urlPrivada
*
* @param string $urlPrivada
*
* @return Banner
*/
public function setUrlPrivada($urlPrivada)
{
$this->urlPrivada = $urlPrivada;
return $this;
}
/**
* Get urlPrivada
*
* @return string
*/
public function getUrlPrivada()
{
return $this->urlPrivada;
}
public function hasImageSet(){
return $this->getImagenEs() || $this->getImagenArchivoEs() || $this->getImagenEn() || $this->getImagenArchivoEn();
}
/**
* Set textoAlt
*
* @param string $textoAlt
*
* @return Banner
*/
public function setTextoAlt($textoAlt)
{
$this->textoAlt = $textoAlt;
return $this;
}
/**
* Get textoAlt
*
* @return string
*/
public function getTextoAlt()
{
return $this->textoAlt;
}
/**
* Set textoAnalitycs
*
* @param string $textoAnalitycs
*
* @return Banner
*/
public function setTextoAnalitycs($textoAnalitycs)
{
$this->textoAnalitycs = $textoAnalitycs;
return $this;
}
/**
* Get textoAnalitycs
*
* @return string
*/
public function getTextoAnalitycs()
{
return $this->textoAnalitycs;
}
}