<?php
namespace App\Entity;
use App\Repository\PopupRepository;
use DateTime;
use DateTimeInterface;
use Doctrine\ORM\Mapping as ORM;
use JMS\Serializer\Annotation as Serializer;
use JMS\Serializer\Annotation\Expose;
use JMS\Serializer\Annotation\Groups;
/**
* @ORM\Entity(repositoryClass=PopupRepository::class)
*
* @Serializer\ExclusionPolicy("ALL")
*/
class Popup
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*
* @Expose
* @Groups({"popup_list"})
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*
* @Expose
* @Groups({"popup_list"})
*/
private $title;
/**
* @ORM\Column(type="text")
*
* @Expose
* @Groups({"popup_list"})
*/
private $content;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*
* @Expose
* @Groups({"popup_list"})
*/
private $linkUrl;
/**
* @ORM\Column(type="boolean")
*
* @Expose
* @Groups({"popup_list"})
*/
private $external;
/**
* @ORM\Column(type="datetime", nullable=true)
*
* @Expose
* @Groups({"popup_list"})
*/
private $dateStart;
/**
* @ORM\Column(type="datetime", nullable=true)
*
* @Expose
* @Groups({"popup_list"})
*/
private $dateEnd;
/**
* @ORM\Column(type="boolean")
*/
private $enabled;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $displayRole;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $displayJob;
public function __construct()
{
$this->enabled = TRUE;
$this->external = FALSE;
$this->dateStart = new DateTime();
$this->dateEnd = new DateTime( '+1 month' );
}
public function getId(): ?int
{
return $this->id;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle( string $title ): self
{
$this->title = $title;
return $this;
}
public function getContent(): ?string
{
return $this->content;
}
public function setContent( string $content ): self
{
$this->content = $content;
return $this;
}
public function getLinkUrl(): ?string
{
return $this->linkUrl;
}
public function setLinkUrl( ?string $linkUrl ): self
{
$this->linkUrl = $linkUrl;
return $this;
}
public function getExternal(): ?bool
{
return $this->external;
}
public function setExternal( bool $external ): self
{
$this->external = $external;
return $this;
}
public function getDateStart(): ?DateTimeInterface
{
return $this->dateStart;
}
public function setDateStart( ?DateTimeInterface $dateStart ): self
{
$this->dateStart = $dateStart;
return $this;
}
public function getDateEnd(): ?DateTimeInterface
{
return $this->dateEnd;
}
public function setDateEnd( ?DateTimeInterface $dateEnd ): self
{
$this->dateEnd = $dateEnd;
return $this;
}
public function getEnabled(): ?bool
{
return $this->enabled;
}
public function setEnabled( bool $enabled ): self
{
$this->enabled = $enabled;
return $this;
}
public function getDisplayRole(): ?array
{
if ( $this->displayRole === NULL ) {
return $this->displayRole;
}
return explode( ';', $this->displayRole );
}
public function setDisplayRole( ?array $displayRole ): self
{
if (!$displayRole || $displayRole === [] ) {
$this->displayRole = NULL;
} else {
$this->displayRole = implode( ';', $displayRole );
}
return $this;
}
public function getDisplayJob(): ?array
{
if ( $this->displayJob === NULL ) {
return $this->displayJob;
}
return explode( ';', $this->displayJob );
}
public function setDisplayJob( ?array $displayJob ): self
{
if ( !$displayJob || $displayJob === [] ) {
$this->displayJob = NULL;
} else {
$this->displayJob = implode( ';', $displayJob );
}
return $this;
}
}