src/Entity/BannerItem.php line 21
- <?php
- namespace App\Entity;
- use Gedmo\Mapping\Annotation as Gedmo;
- use Doctrine\ORM\Mapping as ORM;
- use Doctrine\Common\Collections\ArrayCollection;
- use App\Entity\Banner;
- use A2lix\TranslationFormBundle\Util\Knp\KnpTranslatable;
- use Knp\DoctrineBehaviors\Contract\Entity\TranslatableInterface;
- use Knp\DoctrineBehaviors\Model\Translatable\TranslatableTrait;
- /**
- * BannerItem
- *
- * @ORM\Table(name="banner_item")
- * @ORM\Entity
- */
- class BannerItem implements TranslatableInterface
- {
- /* Begin Translatable */
- use TranslatableTrait;
- public function __call($method, $arguments)
- {
- return $this->proxyCurrentLocaleTranslation($method, $arguments);
- }
- /* End Translatable */
- /**
- * @var string
- *
- * @ORM\Column(name="id", type="integer")
- * @ORM\Id
- * @ORM\GeneratedValue
- */
- private $id;
- /**
- * @var \DateTime
- *
- * @ORM\Column(name="fecha_inicio", type="datetime")
- */
- private $fechaInicio;
- /**
- * @var \DateTime
- *
- * @ORM\Column(name="fecha_fin", type="datetime")
- */
- private $fechaFin;
- /**
- * @ORM\ManyToOne(targetEntity="Banner", inversedBy="items", cascade={"persist"})
- * @ORM\JoinColumn(name="banner_id", referencedColumnName="id"))
- * @Gedmo\SortableGroup
- */
- private $banner;
- /**
- * @var string
- *
- * @ORM\Column(name="target", type="string", length=20, options={"default":"_blank"})
- */
- private $target;
- /**
- * @Gedmo\SortablePosition
- * @ORM\Column(name="position", type="integer")
- */
- private $position;
- /**
- * @var Array
- *
- * @ORM\Column(name="locales", type="array")
- */
- protected $locales;
- public function __construct()
- {
- $this->fechaInicio = new \DateTime();
- $this->fechaFin = new \DateTime();
- $this->fechaFin->modify("+1 year");
- $this->locales = array("es","en","fr");
- $this->target = "_self";
- }
- public function __toString()
- {
- $banner = $this->getBanner();
- if (isset($banner))
- return $this->getBanner()->getNombre().": ".$this->getTitulo();
- elseif ($this->getTitulo())
- return $this->getTitulo();
- else
- return "na";
- }
- /**
- * Set id
- *
- * @param string $id
- * @return Pais
- */
- public function setId($id)
- {
- $this->id = $id;
- return $this;
- }
- /**
- * Get id
- *
- * @return string
- */
- public function getId()
- {
- return $this->id;
- }
- /**
- * Set activo
- *
- * @param boolean $activo
- * @return Pais
- */
- public function setActivo($activo)
- {
- $this->activo = $activo;
- return $this;
- }
- /**
- * Get activo
- *
- * @return boolean
- */
- public function getActivo()
- {
- return $this->activo;
- }
- /**
- * Set banner
- *
- * @param Banner $banner
- * @return BannerItem
- */
- public function setBanner(Banner $banner)
- {
- $this->banner = $banner;
- return $this;
- }
- /**
- * Get banner
- *
- * @return Banner
- */
- public function getBanner()
- {
- return $this->banner;
- }
- /**
- * Set fechaInicio
- *
- * @param DateTime $fechainicio
- * @return BannerItem
- */
- public function setFechaInicio(\DateTime $fechainicio)
- {
- $this->fechaInicio = $fechainicio;
- return $this;
- }
- /**
- * Get fechaInicio
- *
- * @return fechaInicio
- */
- public function getFechaInicio()
- {
- return $this->fechaInicio;
- }
- /**
- * Set fechaFin
- *
- * @param DateTime $fechafin
- * @return BannerItem
- */
- public function setFechaFin(\DateTime $fechafin)
- {
- $this->fechaFin = $fechafin;
- return $this;
- }
- /**
- * Get fechaFin
- *
- * @return fechaFin
- */
- public function getFechaFin()
- {
- return $this->fechaFin;
- }
- /**
- * Set target
- *
- * @param string $target
- * @return BannerItem
- */
- public function setTarget($target)
- {
- $this->target = $target;
- return $this;
- }
- /**
- * Get target
- *
- * @return string
- */
- public function getTarget()
- {
- return $this->target;
- }
- /**
- * Set locales
- *
- * @param array $locales
- * @return BannerItem
- */
- public function setLocales($locales)
- {
- $this->locales = $locales;
- return $this;
- }
- /**
- * Get locales
- *
- * @return array
- */
- public function getLocales()
- {
- return $this->locales;
- }
- public function setPosition($position)
- {
- $this->position = $position;
- return $this;
- }
- public function getPosition()
- {
- return $this->position;
- }
- }