<?php
namespace App\Entity;
use Core\Entity\ControllerList;
use Core\Entity\Traits\EntityTrait;
use Core\Entity\Traits\PageTrait;
use Core\Entity\Traits\TranslatableTrait;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\HttpFoundation\File\File;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
/**
* @Vich\Uploadable
* @ORM\Entity(repositoryClass="App\Repository\PageGeneralRepository")
* @ORM\Table(name="app_page_general")
*/
class PageGeneral
{
use TranslatableTrait;
use EntityTrait {
EntityTrait::__construct as private __entityConstruct;
}
use PageTrait {
PageTrait::__construct as private __pageConstruct;
}
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $sitename;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $domain;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @var string
*/
private $logo;
/**
* @Vich\UploadableField(mapping="images", fileNameProperty="logo")
* @var File
*/
private $logoFile;
/**
* @ORM\Column(type="boolean")
*/
protected $use_popin;
/**
* @ORM\Column(type="boolean")
*/
protected $use_cookie_popin;
/**
* @ORM\Column(type="string", length=255,nullable=true)
*/
protected $popin_cookie_name;
/**
* @ORM\Column(type="boolean")
*/
protected $use_popin_redirect;
/**
* @ORM\Column(type="string", length=255,nullable=true)
*/
protected $popin_redirect;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @var string
*/
private $popin;
/**
* @Vich\UploadableField(mapping="images", fileNameProperty="popin")
* @var File
*/
private $popinFile;
/**
* @ORM\OneToMany(targetEntity="App\Entity\PageSlide", mappedBy="page_general", cascade={"persist", "remove"},
* orphanRemoval=true)
*/
private $slides;
/**
* @ORM\OneToMany(targetEntity="App\Entity\PageText", mappedBy="page_general", cascade={"persist", "remove"},
* orphanRemoval=true)
*/
private $texts;
/**
* @ORM\OneToMany(targetEntity="App\Entity\PageImage", mappedBy="page_general", cascade={"persist", "remove"},
* orphanRemoval=true)
*/
private $images;
/**
* @ORM\OneToMany(targetEntity="App\Entity\PageItem", mappedBy="page_general", cascade={"persist", "remove"},
* orphanRemoval=true)
*/
private $items;
private $collections = [
'image', 'slide', 'text', 'item'
];
/**
* Constructeur
* @throws \Exception
*/
public function __construct()
{
$this->__entityConstruct();
$this->__pageConstruct();
$this->images = new ArrayCollection();
$this->slides = new ArrayCollection();
$this->texts = new ArrayCollection();
$this->items = new ArrayCollection();
}
public function getCollections()
{
return $this->collections;
}
/**
* Collection - Items
*/
public function getItems()
{
return $this->items;
}
public function setItems($items)
{
$this->items = $items;
return $this;
}
public function addItem($item)
{
$this->items->add($item);
$item->setPageGeneral($this);
return $this;
}
public function removeItem($item)
{
$this->items->removeElement($item);
return $this;
}
/**
* Collection - Texts
*/
public function getTexts()
{
return $this->getCollectionSortBySortorder($this->texts);
}
public function getTextsArray()
{
return $this->getCollectionArraySortBySortorder($this->texts);
}
public function setTexts($items)
{
$this->texts = $items;
return $this;
}
public function addText($item)
{
$this->texts->add($item);
$item->setPageGeneral($this);
return $this;
}
public function removeText($item)
{
$this->texts->removeElement($item);
return $this;
}
/**
* Collection - Images
*/
public function getImagesArray()
{
return $this->getCollectionArraySortBySortorder($this->images);
}
public function getImages()
{
return $this->images;
}
public function setImages($items)
{
$this->images = $items;
return $this;
}
public function addImage($item)
{
$this->images->add($item);
$item->setPageGeneral($this);
return $this;
}
public function removeImage($item)
{
$this->images->removeElement($item);
return $this;
}
/**
* Collection - Slides
*/
public function getSlides()
{
return $this->slides;
}
public function setSlides($items)
{
$this->slides = $items;
return $this;
}
public function addSlide($item)
{
$this->slides->add($item);
$item->setPageGeneral($this);
return $this;
}
public function removeSlide($item)
{
$this->slides->removeElement($item);
return $this;
}
/**
* @return mixed
*/
public function getSitename()
{
return $this->sitename;
}
/**
* @param mixed $sitename
*/
public function setSitename($sitename): void
{
$this->sitename = $sitename;
}
public function getDomain()
{
return $this->domain;
}
public function setDomain($domain)
{
$this->domain = $domain;
}
public function getLogo()
{
return $this->logo;
}
public function setLogo($logo)
{
$this->logo = $logo;
}
public function getLogoFile()
{
return $this->logoFile;
}
public function setLogoFile($logoFile)
{
$this->logoFile = $logoFile;
if ($logoFile) {
$this->setUpdatedAt(new \DateTime('now'));
}
}
public function getUsePopin()
{
return $this->use_popin;
}
public function setUsePopin($use_popin)
{
$this->use_popin = $use_popin;
}
public function getPopin()
{
return $this->popin;
}
public function setPopin($popin)
{
$this->popin = $popin;
}
public function getPopinFile()
{
return $this->popinFile;
}
public function setPopinFile($popinFile)
{
$this->popinFile = $popinFile;
if ($popinFile) {
$this->setUpdatedAt(new \DateTime('now'));
}
}
public function getUseCookiePopin()
{
return $this->use_cookie_popin;
}
public function setUseCookiePopin($use_cookie_popin)
{
$this->use_cookie_popin = $use_cookie_popin;
}
public function getPopinCookieName()
{
return $this->popin_cookie_name;
}
public function setPopinCookieName($popin_cookie_name)
{
$this->popin_cookie_name = $popin_cookie_name;
}
public function getPopinRedirect()
{
return $this->popin_redirect;
}
public function setPopinRedirect($popin_redirect)
{
$this->popin_redirect = $popin_redirect;
}
public function getUsePopinRedirect()
{
return $this->use_popin_redirect;
}
public function setUsePopinRedirect($use_popin_redirect)
{
$this->use_popin_redirect = $use_popin_redirect;
}
}