src/AppBundle/Entity/ComponenteCarousel.php line 20
<?php
namespace AppBundle\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Filesystem\Filesystem as File;
/**
* Componente.
*
* @ORM\Table(name="componente")
* @ORM\Entity(repositoryClass="AppBundle\Repository\ComponenteRepository")
* @ORM\HasLifecycleCallbacks()
*/
class ComponenteCarousel extends Componente
{
/**
* @Assert\NotBlank
*/
private $titulo;
/**
* @Assert\Count(
* min = 1,
* minMessage = "De cargar al menos una imagen",
* )
*/
protected $items = [];
public function __construct()
{
$this->items = new ArrayCollection();
}
/**
* Get the value of titulo
*/
public function getTitulo()
{
return $this->titulo;
}
/**
* Set the value of titulo
*
* @return self
*/
public function setTitulo($titulo)
{
$this->titulo = $titulo;
return $this;
}
public function addItem(ComponenteItem $item) {
$this->items->add($item);
return $this;
}
public function removeItem(ComponenteItem $item)
{
$this->items->removeElement($item);
}
public function getItems() {
return $this->items;
}
public function _toComponente()
{
$componente = new Componente();
$componente
->setId($this->id)
->setOrden($this->orden)
->setVisibilidad($this->visibilidad)
->setFullWidth($this->fullWidth)
->setDescripcion($this->descripcion)
->setTipoId($this->tipoId)
->setTipo($this->tipo)
->setMobile($this->isMobile())
->setConfiguracion(
json_encode(
[
'titulo' => $this->titulo,
'items' => []
]
)
);
return $componente;
}
}