<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\HttpFoundation\File\File;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
/**
* @ORM\Entity(repositoryClass="App\Repository\TimelineRepository")
* @Vich\Uploadable
*/
class Timeline
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string")
*/
private $title;
/**
* @ORM\Column(type="string")
*/
private $slug;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $header;
/**
* @Vich\UploadableField(mapping="timeline", fileNameProperty="header")
* @var File
*/
private $headerFile;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $rcmagTopicId;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $rcmagPosterId;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $rcnewsPosterId;
/**
* @ORM\Column(type="datetime")
* @var \DateTime
*/
private $startDate;
/**
* @ORM\Column(type="datetime")
* @var \DateTime
*/
private $endDate;
/**
* One Timeline has Many Articles.
* @ORM\OneToMany(targetEntity="Article", mappedBy="timeline")
* @ORM\OrderBy({"id" = "DESC"})
*/
private $articles;
/**
* @ORM\Column(type="datetime", nullable=true)
* @var \DateTime
*/
private $updatedAt;
public function __construct()
{
$this->articles = new ArrayCollection();
$this->startDate = new \DateTime();
$this->endDate = new \DateTime();
$this->updatedAt = new \DateTime();
}
/**
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* @param integer $id
*/
public function setId($id): void
{
$this->id = $id;
}
/**
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* @param string $title
*/
public function setTitle($title): void
{
$this->title = $title;
}
/**
* @return string
*/
public function getSlug()
{
return $this->slug;
}
/**
* @param string $slug
*/
public function setSlug($slug): void
{
$this->slug = $slug;
}
/**
* @return string
*/
public function getHeader()
{
return $this->header;
}
/**
* @param string $header
*/
public function setHeader($header): void
{
$this->header = $header;
}
public function setHeaderFile(File $header = null)
{
$this->headerFile = $header;
if ($header) {
$this->updatedAt = new \DateTime('now');
}
}
public function getHeaderFile()
{
return $this->headerFile;
}
/**
* @return mixed
*/
public function getRcmagTopicId()
{
return $this->rcmagTopicId;
}
/**
* @param mixed $rcmagTopicId
*/
public function setRcmagTopicId($rcmagTopicId): void
{
$this->rcmagTopicId = $rcmagTopicId;
}
/**
* @return mixed
*/
public function getRcmagPosterId()
{
return $this->rcmagPosterId;
}
/**
* @param mixed $rcmagPosterId
*/
public function setRcmagPosterId($rcmagPosterId): void
{
$this->rcmagPosterId = $rcmagPosterId;
}
/**
* @return mixed
*/
public function getRcnewsPosterId()
{
return $this->rcnewsPosterId;
}
/**
* @param mixed $rcnewsPosterId
*/
public function setRcnewsPosterId($rcnewsPosterId): void
{
$this->rcnewsPosterId = $rcnewsPosterId;
}
/**
* @return \DateTime
*/
public function getStartDate()
{
return $this->startDate;
}
/**
* @param \DateTime $startDate
*/
public function setStartDate(\DateTime $startDate): void
{
$this->startDate = $startDate;
}
/**
* @return \DateTime
*/
public function getEndDate()
{
return $this->endDate;
}
/**
* @param \DateTime $endDate
*/
public function setEndDate(\DateTime $endDate): void
{
$this->endDate = $endDate;
}
/**
* @return ArrayCollection|Article[]
*/
public function getArticles()
{
return $this->articles;
}
public function __toString()
{
return $this->title;
}
}