<?php
namespace App\Entity\Post;
use App\Entity\BaseEntity;
use App\Entity\Finance\PostEarning;
use App\Entity\Media\Media;
use App\Entity\Program\Program;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Table(name="post")
* @ORM\Entity(repositoryClass="App\Repository\Post\PostRepository")
* @ORM\HasLifecycleCallbacks()
*/
class Post extends BaseEntity
{
/**
* @ORM\Column(type="boolean")
*/
private $isSuspended;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Media\Media",inversedBy="posts")
*/
private $media;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Program\Program",inversedBy="posts")
*/
private $program;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $dynamicLink;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $shortDynamicLink;
/**
* @ORM\Column(type="string", length=255)
*/
private $title;
//Champ pour timing
/**
* @ORM\Column(type="boolean")
*/
private $is24h;
/**
* @ORM\Column(type="time", nullable=true)
*/
private $timeFrom;
/**
* @ORM\Column(type="time", nullable=true)
*/
private $timeTo;
/**
* @ORM\Column(type="json", length=255, nullable=true)
*/
private $day;
/**
* @ORM\Column(type="date")
*/
private $dateFrom;
/**
* @ORM\Column(type="date", nullable=true)
*/
private $dateTo;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $rules;
//DISPLAY SETTING
/**
* @ORM\Column(type="boolean")
*/
private $isColor;
private $posterFile;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $poster;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $textColor;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $backgroundColor;
public $schedule;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $content;
/**
* @ORM\Column(type="string", length=255)
*/
private $type;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Post\Poll", cascade={"persist", "remove"})
*/
private $poll;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Post\Vote", cascade={"persist", "remove"})
*/
private $vote;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Post\Donation", cascade={"persist", "remove"})
*/
private $donation;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Post\Game", cascade={"persist", "remove"})
*/
private $game;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Post\Quiz", cascade={"persist", "remove" })
*/
private $quiz;
// TOBE deleted
/**
* @ORM\Column(type="boolean")
*/
private $isSponsorise;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $description;
/**
* @ORM\Column(type="integer")
*/
private $nbrShare;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Post\Comment",mappedBy="post",cascade={"persist"})
*/
private $comments;
/**
* @ORM\Column(type="integer")
*/
private $nbrLike;
/**
* @ORM\Column(type="integer")
*/
private $nbrDisLike;
/**
* @ORM\Column(type="integer")
*/
public $nbrComments;
/**
* @ORM\Column(type="integer")
*/
public $nbrParticipation;
/**
* @ORM\Column(type="integer")
*/
public $nbrAccessByQR;
/**
* @ORM\Column(type="integer")
*/
public $nbrAccessByLink;
/**
* @ORM\Column(type="integer", options={"default" : 0})
*/
public $score;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Finance\PostEarning",mappedBy="post",cascade={"persist"})
*/
private $postEarnings;
public $isLike;
public $isDislike;
public function __construct()
{
$this->isSuspended = false;
$this->isColor = 1;
$this->isSponsorise = false;
$this->nbrLike = 0;
$this->nbrDisLike = 0;
$this->nbrComments = 0;
$this->nbrParticipation = 0;
$this->nbrAccessByQR = 0;
$this->nbrAccessByLink = 0;
$this->nbrShare = 0;
$this->comments = new ArrayCollection();
$this->score = 0;
$this->earningTotal = 0;
$this->postEarnings = new ArrayCollection();
}
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 getIs24h(): ?bool
{
return $this->is24h;
}
public function setIs24h(bool $is24h): self
{
$this->is24h = $is24h;
return $this;
}
public function getTimeFrom()//: ?\DateTimeInterface
{
//$date = new \DateTime('2000-01-01');
//return $date->format('Y-m-d H:i:s');
return $this->timeFrom; //new \DateTime($this->timeFrom); //date("H:i:s", $this->timeFrom);
}
public function setTimeFrom(\DateTimeInterface $timeFrom): self
{
//$date = new \DateTime('2000-01-01');
//echo $date->format('Y-m-d H:i:s');
//$this->timeFrom = $date->format('Y-m-d H:i:s');
//echo date("H:i:s", strtotime($timeFrom));
$this->timeFrom = $timeFrom ;//new \DateTime($timeFrom);
return $this;
}
public function getTimeTo(): ?\DateTimeInterface
{
return $this->timeTo;
}
public function setTimeTo(\DateTimeInterface $timeTo): self
{
$this->timeTo = $timeTo; //strtotime($timeTo);
return $this;
}
public function getDateFrom(): ?\DateTimeInterface
{
return $this->dateFrom;
}
public function setDateFrom(\DateTimeInterface $dateFrom): self
{
$this->dateFrom = $dateFrom;
return $this;
}
public function getDateTo(): ?\DateTimeInterface
{
return $this->dateTo;
}
public function setDateTo(\DateTimeInterface $dateTo): self
{
$this->dateTo = $dateTo;
return $this;
}
public function getRules(): ?string
{
return $this->rules;
}
public function setRules(string $rules): self
{
$this->rules = $rules;
return $this;
}
public function getIsColor(): ?bool
{
return $this->isColor;
}
public function setIsColor(bool $isColor): self
{
$this->isColor = $isColor;
return $this;
}
public function getTextColor(): ?string
{
return $this->textColor;
}
public function setTextColor(string $textColor): self
{
$this->textColor = $textColor;
return $this;
}
public function getBackgroundColor(): ?string
{
return $this->backgroundColor;
}
public function setBackgroundColor(string $backgroundColor): self
{
$this->backgroundColor = $backgroundColor;
return $this;
}
public function getContent(): ?string
{
return $this->content;
}
public function setContent(string $content): self
{
$this->content = $content;
return $this;
}
public function getType(): ?string
{
return $this->type;
}
public function setType(string $type): self
{
$this->type = $type;
return $this;
}
public function getMedia(): ?Media
{
return $this->media;
}
public function setMedia(?Media $media): self
{
$this->media = $media;
return $this;
}
public function getProgram(): ?Program
{
return $this->program;
}
public function setProgram(?Program $program): self
{
$this->program = $program;
return $this;
}
public function getPoll(): ?Poll
{
return $this->poll;
}
public function setPoll(?Poll $poll): self
{
$this->poll = $poll;
return $this;
}
public function getVote(): ?Vote
{
return $this->vote;
}
public function setVote(?Vote $vote): self
{
$this->vote = $vote;
return $this;
}
public function getDonation(): ?Donation
{
return $this->donation;
}
public function setDonation(?Donation $donation): self
{
$this->donation = $donation;
return $this;
}
public function getGame(): ?Game
{
return $this->game;
}
public function setGame(?Game $game): self
{
$this->game = $game;
return $this;
}
public function getQuiz(): ?Quiz
{
return $this->quiz;
}
public function setQuiz(?Quiz $quiz): self
{
$this->quiz = $quiz;
return $this;
}
public function getDay(): ?array
{
return $this->day;
}
public function setDay(?array $day): self
{
$this->day = $day;
return $this;
}
public function getPoster(): ?string
{
return $this->poster;
}
public function setPoster(?string $poster): self
{
$this->poster = $poster;
return $this;
}
public function getIsSponsorise(): ?bool
{
return $this->isSponsorise;
}
public function setIsSponsorise(bool $isSponsorise): self
{
$this->isSponsorise = $isSponsorise;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(string $description): self
{
$this->description = $description;
return $this;
}
public function getNbrLike(): ?int
{
return $this->nbrLike;
}
public function setNbrLike(int $nbrLike): self
{
$this->nbrLike = $nbrLike;
return $this;
}
public function getNbrShare(): ?int
{
return $this->nbrShare;
}
public function setNbrShare(int $nbrShare): self
{
$this->nbrShare = $nbrShare;
return $this;
}
/**
* @return Collection|Comment[]
*/
public function getComments(): Collection
{
return $this->comments;
}
public function addComment(Comment $comment): self
{
if (!$this->comments->contains($comment)) {
$this->comments[] = $comment;
$comment->setPost($this);
}
return $this;
}
public function removeComment(Comment $comment): self
{
if ($this->comments->contains($comment)) {
$this->comments->removeElement($comment);
// set the owning side to null (unless already changed)
if ($comment->getPost() === $this) {
$comment->setPost(null);
}
}
return $this;
}
public function getNbrDisLike(): ?int
{
return $this->nbrDisLike;
}
public function setNbrDisLike(int $nbrDisLike): self
{
$this->nbrDisLike = $nbrDisLike;
return $this;
}
public function getNbrComments(): ?int
{
return $this->nbrComments;
}
public function setNbrComments(int $nbrComments): self
{
$this->nbrComments = $nbrComments;
return $this;
}
public function getNbrParticipation(): ?int
{
return $this->nbrParticipation;
}
public function setNbrParticipation(int $nbrParticipation): self
{
$this->nbrParticipation = $nbrParticipation;
return $this;
}
public function getNbrAccessByQR(): ?int
{
return $this->nbrAccessByQR;
}
public function setNbrAccessByQR(int $nbrAccessByQR): self
{
$this->nbrAccessByQR = $nbrAccessByQR;
return $this;
}
public function getNbrAccessByLink(): ?int
{
return $this->nbrAccessByLink;
}
public function setNbrAccessByLink(int $nbrAccessByLink): self
{
$this->nbrAccessByLink = $nbrAccessByLink;
return $this;
}
public function getScore(): ?int
{
return $this->score;
}
public function setScore(int $score): self
{
$this->score = $score;
return $this;
}
public function getIsSuspended(): ?bool
{
return $this->isSuspended;
}
public function setIsSuspended(bool $isSuspended): self
{
$this->isSuspended = $isSuspended;
return $this;
}
public function getDynamicLink(): ?string
{
return $this->dynamicLink;
}
public function setDynamicLink(?string $dynamicLink): self
{
$this->dynamicLink = $dynamicLink;
return $this;
}
public function getShortDynamicLink(): ?string
{
return $this->shortDynamicLink;
}
public function setShortDynamicLink(?string $shortDynamicLink): self
{
$this->shortDynamicLink = $shortDynamicLink;
return $this;
}
public function getEarningTotal(): ?float
{
return $this->earningTotal;
}
public function setEarningTotal(float $earningTotal): self
{
$this->earningTotal = $earningTotal;
return $this;
}
/**
* @return Collection|PostEarning[]
*/
public function getPostEarnings(): Collection
{
return $this->postEarnings;
}
public function addPostEarning(PostEarning $postEarning): self
{
if (!$this->postEarnings->contains($postEarning)) {
$this->postEarnings[] = $postEarning;
$postEarning->setPost($this);
}
return $this;
}
public function removePostEarning(PostEarning $postEarning): self
{
if ($this->postEarnings->removeElement($postEarning)) {
// set the owning side to null (unless already changed)
if ($postEarning->getPost() === $this) {
$postEarning->setPost(null);
}
}
return $this;
}
}