src/Entity/Post/Post.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Post;
  3. use App\Entity\BaseEntity;
  4. use App\Entity\Finance\PostEarning;
  5. use App\Entity\Media\Media;
  6. use App\Entity\Program\Program;
  7. use Doctrine\Common\Collections\ArrayCollection;
  8. use Doctrine\Common\Collections\Collection;
  9. use Doctrine\ORM\Mapping as ORM;
  10. /**
  11.  * @ORM\Table(name="post")
  12.  * @ORM\Entity(repositoryClass="App\Repository\Post\PostRepository")
  13.  * @ORM\HasLifecycleCallbacks()
  14.  */
  15. class Post extends BaseEntity
  16. {
  17.     /**
  18.      * @ORM\Column(type="boolean")
  19.      */
  20.     private $isSuspended;
  21.     /**
  22.      * @ORM\ManyToOne(targetEntity="App\Entity\Media\Media",inversedBy="posts")
  23.      */
  24.     private $media;
  25.     /**
  26.      * @ORM\ManyToOne(targetEntity="App\Entity\Program\Program",inversedBy="posts")
  27.      */
  28.     private $program;
  29.     /**
  30.      * @ORM\Column(type="text", nullable=true)
  31.      */
  32.     private $dynamicLink;
  33.     /**
  34.      * @ORM\Column(type="string", length=255, nullable=true)
  35.      */
  36.     private $shortDynamicLink;
  37.     /**
  38.      * @ORM\Column(type="string", length=255)
  39.      */
  40.     private $title;
  41.     //Champ pour timing
  42.     /**
  43.      * @ORM\Column(type="boolean")
  44.      */
  45.     private $is24h;
  46.     /**
  47.      * @ORM\Column(type="time", nullable=true)
  48.      */
  49.     private $timeFrom;
  50.     /**
  51.      * @ORM\Column(type="time", nullable=true)
  52.      */
  53.     private $timeTo;
  54.     /**
  55.      * @ORM\Column(type="json", length=255, nullable=true)
  56.      */
  57.     private $day;
  58.     /**
  59.      * @ORM\Column(type="date")
  60.      */
  61.     private $dateFrom;
  62.     /**
  63.      * @ORM\Column(type="date", nullable=true)
  64.      */
  65.     private $dateTo;
  66.     /**
  67.      * @ORM\Column(type="text", nullable=true)
  68.      */
  69.     private $rules;
  70.     //DISPLAY SETTING
  71.     /**
  72.      * @ORM\Column(type="boolean")
  73.      */
  74.     private $isColor;
  75.     private $posterFile;
  76.     /**
  77.      * @ORM\Column(type="string", length=255, nullable=true)
  78.      */
  79.     private $poster;
  80.     /**
  81.      * @ORM\Column(type="string", length=255, nullable=true)
  82.      */
  83.     private $textColor;
  84.     /**
  85.      * @ORM\Column(type="string", length=255, nullable=true)
  86.      */
  87.     private $backgroundColor;
  88.     public $schedule;
  89.     /**
  90.      * @ORM\Column(type="text", nullable=true)
  91.      */
  92.     private $content;
  93.     /**
  94.      * @ORM\Column(type="string", length=255)
  95.      */
  96.     private $type;
  97.     /**
  98.      * @ORM\ManyToOne(targetEntity="App\Entity\Post\Poll", cascade={"persist", "remove"})
  99.      */
  100.     private $poll;
  101.     /**
  102.      * @ORM\ManyToOne(targetEntity="App\Entity\Post\Vote", cascade={"persist", "remove"})
  103.      */
  104.     private $vote;
  105.     /**
  106.      * @ORM\ManyToOne(targetEntity="App\Entity\Post\Donation", cascade={"persist", "remove"})
  107.      */
  108.     private $donation;
  109.     /**
  110.      * @ORM\ManyToOne(targetEntity="App\Entity\Post\Game", cascade={"persist", "remove"})
  111.      */
  112.     private $game;
  113.     /**
  114.      * @ORM\ManyToOne(targetEntity="App\Entity\Post\Quiz", cascade={"persist", "remove" })
  115.      */
  116.     private $quiz;
  117.     // TOBE deleted
  118.     /**
  119.      * @ORM\Column(type="boolean")
  120.      */
  121.     private $isSponsorise;
  122.     /**
  123.      * @ORM\Column(type="text", nullable=true)
  124.      */
  125.     private $description;
  126.     /**
  127.      * @ORM\Column(type="integer")
  128.      */
  129.     private $nbrShare;
  130.     /**
  131.      * @ORM\OneToMany(targetEntity="App\Entity\Post\Comment",mappedBy="post",cascade={"persist"})
  132.      */
  133.     private $comments;
  134.     /**
  135.      * @ORM\Column(type="integer")
  136.      */
  137.     private $nbrLike;
  138.     /**
  139.      * @ORM\Column(type="integer")
  140.      */
  141.     private $nbrDisLike;
  142.     /**
  143.      * @ORM\Column(type="integer")
  144.      */
  145.     public $nbrComments;
  146.     /**
  147.      * @ORM\Column(type="integer")
  148.      */
  149.     public $nbrParticipation;
  150.     /**
  151.      * @ORM\Column(type="integer")
  152.      */
  153.     public $nbrAccessByQR;
  154.     /**
  155.      * @ORM\Column(type="integer")
  156.      */
  157.     public $nbrAccessByLink;
  158.     /**
  159.      * @ORM\Column(type="integer", options={"default" : 0})
  160.      */
  161.     public $score;
  162.     /**
  163.      * @ORM\OneToMany(targetEntity="App\Entity\Finance\PostEarning",mappedBy="post",cascade={"persist"})
  164.      */
  165.     private $postEarnings;
  166.     public $isLike;
  167.     public $isDislike;
  168.     public function __construct()
  169.     {
  170.         $this->isSuspended false;
  171.         $this->isColor 1;
  172.         $this->isSponsorise false;
  173.         $this->nbrLike 0;
  174.         $this->nbrDisLike 0;
  175.         $this->nbrComments 0;
  176.         $this->nbrParticipation 0;
  177.         $this->nbrAccessByQR 0;
  178.         $this->nbrAccessByLink 0;
  179.         $this->nbrShare 0;
  180.         $this->comments = new ArrayCollection();
  181.         $this->score 0;
  182.         $this->earningTotal 0;
  183.         $this->postEarnings = new ArrayCollection();
  184.     }
  185.     public function getId(): ?int
  186.     {
  187.         return $this->id;
  188.     }
  189.     public function getTitle(): ?string
  190.     {
  191.         return $this->title;
  192.     }
  193.     public function setTitle(string $title): self
  194.     {
  195.         $this->title $title;
  196.         return $this;
  197.     }
  198.     public function getIs24h(): ?bool
  199.     {
  200.         return $this->is24h;
  201.     }
  202.     public function setIs24h(bool $is24h): self
  203.     {
  204.         $this->is24h $is24h;
  205.         return $this;
  206.     }
  207.     public function getTimeFrom()//: ?\DateTimeInterface
  208.     {
  209.         //$date = new \DateTime('2000-01-01');
  210.         //return $date->format('Y-m-d H:i:s');
  211.         return $this->timeFrom//new \DateTime($this->timeFrom); //date("H:i:s", $this->timeFrom);
  212.     }
  213.     public function setTimeFrom(\DateTimeInterface $timeFrom): self
  214.     {
  215.         //$date = new \DateTime('2000-01-01');
  216.         //echo $date->format('Y-m-d H:i:s');
  217.         //$this->timeFrom = $date->format('Y-m-d H:i:s');
  218.         //echo date("H:i:s", strtotime($timeFrom));
  219.         $this->timeFrom $timeFrom ;//new \DateTime($timeFrom);
  220.         return $this;
  221.     }
  222.     public function getTimeTo(): ?\DateTimeInterface
  223.     {
  224.         return $this->timeTo;
  225.     }
  226.     public function setTimeTo(\DateTimeInterface $timeTo): self
  227.     {
  228.         $this->timeTo $timeTo//strtotime($timeTo);
  229.         return $this;
  230.     }
  231.     public function getDateFrom(): ?\DateTimeInterface
  232.     {
  233.         return $this->dateFrom;
  234.     }
  235.     public function setDateFrom(\DateTimeInterface $dateFrom): self
  236.     {
  237.         $this->dateFrom $dateFrom;
  238.         return $this;
  239.     }
  240.     public function getDateTo(): ?\DateTimeInterface
  241.     {
  242.         return $this->dateTo;
  243.     }
  244.     public function setDateTo(\DateTimeInterface $dateTo): self
  245.     {
  246.         $this->dateTo $dateTo;
  247.         return $this;
  248.     }
  249.     public function getRules(): ?string
  250.     {
  251.         return $this->rules;
  252.     }
  253.     public function setRules(string $rules): self
  254.     {
  255.         $this->rules $rules;
  256.         return $this;
  257.     }
  258.     public function getIsColor(): ?bool
  259.     {
  260.         return $this->isColor;
  261.     }
  262.     public function setIsColor(bool $isColor): self
  263.     {
  264.         $this->isColor $isColor;
  265.         return $this;
  266.     }
  267.     public function getTextColor(): ?string
  268.     {
  269.         return $this->textColor;
  270.     }
  271.     public function setTextColor(string $textColor): self
  272.     {
  273.         $this->textColor $textColor;
  274.         return $this;
  275.     }
  276.     public function getBackgroundColor(): ?string
  277.     {
  278.         return $this->backgroundColor;
  279.     }
  280.     public function setBackgroundColor(string $backgroundColor): self
  281.     {
  282.         $this->backgroundColor $backgroundColor;
  283.         return $this;
  284.     }
  285.     public function getContent(): ?string
  286.     {
  287.         return $this->content;
  288.     }
  289.     public function setContent(string $content): self
  290.     {
  291.         $this->content $content;
  292.         return $this;
  293.     }
  294.     public function getType(): ?string
  295.     {
  296.         return $this->type;
  297.     }
  298.     public function setType(string $type): self
  299.     {
  300.         $this->type $type;
  301.         return $this;
  302.     }
  303.     public function getMedia(): ?Media
  304.     {
  305.         return $this->media;
  306.     }
  307.     public function setMedia(?Media $media): self
  308.     {
  309.         $this->media $media;
  310.         return $this;
  311.     }
  312.     public function getProgram(): ?Program
  313.     {
  314.         return $this->program;
  315.     }
  316.     public function setProgram(?Program $program): self
  317.     {
  318.         $this->program $program;
  319.         return $this;
  320.     }
  321.     public function getPoll(): ?Poll
  322.     {
  323.         return $this->poll;
  324.     }
  325.     public function setPoll(?Poll $poll): self
  326.     {
  327.         $this->poll $poll;
  328.         return $this;
  329.     }
  330.     public function getVote(): ?Vote
  331.     {
  332.         return $this->vote;
  333.     }
  334.     public function setVote(?Vote $vote): self
  335.     {
  336.         $this->vote $vote;
  337.         return $this;
  338.     }
  339.     public function getDonation(): ?Donation
  340.     {
  341.         return $this->donation;
  342.     }
  343.     public function setDonation(?Donation $donation): self
  344.     {
  345.         $this->donation $donation;
  346.         return $this;
  347.     }
  348.     public function getGame(): ?Game
  349.     {
  350.         return $this->game;
  351.     }
  352.     public function setGame(?Game $game): self
  353.     {
  354.         $this->game $game;
  355.         return $this;
  356.     }
  357.     public function getQuiz(): ?Quiz
  358.     {
  359.         return $this->quiz;
  360.     }
  361.     public function setQuiz(?Quiz $quiz): self
  362.     {
  363.         $this->quiz $quiz;
  364.         return $this;
  365.     }
  366.     public function getDay(): ?array
  367.     {
  368.         return $this->day;
  369.     }
  370.     public function setDay(?array $day): self
  371.     {
  372.         $this->day $day;
  373.         return $this;
  374.     }
  375.     public function getPoster(): ?string
  376.     {
  377.         return $this->poster;
  378.     }
  379.     public function setPoster(?string $poster): self
  380.     {
  381.         $this->poster $poster;
  382.         return $this;
  383.     }
  384.     public function getIsSponsorise(): ?bool
  385.     {
  386.         return $this->isSponsorise;
  387.     }
  388.     public function setIsSponsorise(bool $isSponsorise): self
  389.     {
  390.         $this->isSponsorise $isSponsorise;
  391.         return $this;
  392.     }
  393.     public function getDescription(): ?string
  394.     {
  395.         return $this->description;
  396.     }
  397.     public function setDescription(string $description): self
  398.     {
  399.         $this->description $description;
  400.         return $this;
  401.     }
  402.     public function getNbrLike(): ?int
  403.     {
  404.         return $this->nbrLike;
  405.     }
  406.     public function setNbrLike(int $nbrLike): self
  407.     {
  408.         $this->nbrLike $nbrLike;
  409.         return $this;
  410.     }
  411.     public function getNbrShare(): ?int
  412.     {
  413.         return $this->nbrShare;
  414.     }
  415.     public function setNbrShare(int $nbrShare): self
  416.     {
  417.         $this->nbrShare $nbrShare;
  418.         return $this;
  419.     }
  420.     /**
  421.      * @return Collection|Comment[]
  422.      */
  423.     public function getComments(): Collection
  424.     {
  425.         return $this->comments;
  426.     }
  427.     public function addComment(Comment $comment): self
  428.     {
  429.         if (!$this->comments->contains($comment)) {
  430.             $this->comments[] = $comment;
  431.             $comment->setPost($this);
  432.         }
  433.         return $this;
  434.     }
  435.     public function removeComment(Comment $comment): self
  436.     {
  437.         if ($this->comments->contains($comment)) {
  438.             $this->comments->removeElement($comment);
  439.             // set the owning side to null (unless already changed)
  440.             if ($comment->getPost() === $this) {
  441.                 $comment->setPost(null);
  442.             }
  443.         }
  444.         return $this;
  445.     }
  446.     public function getNbrDisLike(): ?int
  447.     {
  448.         return $this->nbrDisLike;
  449.     }
  450.     public function setNbrDisLike(int $nbrDisLike): self
  451.     {
  452.         $this->nbrDisLike $nbrDisLike;
  453.         return $this;
  454.     }
  455.     public function getNbrComments(): ?int
  456.     {
  457.         return $this->nbrComments;
  458.     }
  459.     public function setNbrComments(int $nbrComments): self
  460.     {
  461.         $this->nbrComments $nbrComments;
  462.         return $this;
  463.     }
  464.     public function getNbrParticipation(): ?int
  465.     {
  466.         return $this->nbrParticipation;
  467.     }
  468.     public function setNbrParticipation(int $nbrParticipation): self
  469.     {
  470.         $this->nbrParticipation $nbrParticipation;
  471.         return $this;
  472.     }
  473.     public function getNbrAccessByQR(): ?int
  474.     {
  475.         return $this->nbrAccessByQR;
  476.     }
  477.     public function setNbrAccessByQR(int $nbrAccessByQR): self
  478.     {
  479.         $this->nbrAccessByQR $nbrAccessByQR;
  480.         return $this;
  481.     }
  482.     public function getNbrAccessByLink(): ?int
  483.     {
  484.         return $this->nbrAccessByLink;
  485.     }
  486.     public function setNbrAccessByLink(int $nbrAccessByLink): self
  487.     {
  488.         $this->nbrAccessByLink $nbrAccessByLink;
  489.         return $this;
  490.     }
  491.     public function getScore(): ?int
  492.     {
  493.         return $this->score;
  494.     }
  495.     public function setScore(int $score): self
  496.     {
  497.         $this->score $score;
  498.         return $this;
  499.     }
  500.     public function getIsSuspended(): ?bool
  501.     {
  502.         return $this->isSuspended;
  503.     }
  504.     public function setIsSuspended(bool $isSuspended): self
  505.     {
  506.         $this->isSuspended $isSuspended;
  507.         return $this;
  508.     }
  509.     public function getDynamicLink(): ?string
  510.     {
  511.         return $this->dynamicLink;
  512.     }
  513.     public function setDynamicLink(?string $dynamicLink): self
  514.     {
  515.         $this->dynamicLink $dynamicLink;
  516.         return $this;
  517.     }
  518.     public function getShortDynamicLink(): ?string
  519.     {
  520.         return $this->shortDynamicLink;
  521.     }
  522.     public function setShortDynamicLink(?string $shortDynamicLink): self
  523.     {
  524.         $this->shortDynamicLink $shortDynamicLink;
  525.         return $this;
  526.     }
  527.     public function getEarningTotal(): ?float
  528.     {
  529.         return $this->earningTotal;
  530.     }
  531.     public function setEarningTotal(float $earningTotal): self
  532.     {
  533.         $this->earningTotal $earningTotal;
  534.         return $this;
  535.     }
  536.     /**
  537.      * @return Collection|PostEarning[]
  538.      */
  539.     public function getPostEarnings(): Collection
  540.     {
  541.         return $this->postEarnings;
  542.     }
  543.     public function addPostEarning(PostEarning $postEarning): self
  544.     {
  545.         if (!$this->postEarnings->contains($postEarning)) {
  546.             $this->postEarnings[] = $postEarning;
  547.             $postEarning->setPost($this);
  548.         }
  549.         return $this;
  550.     }
  551.     public function removePostEarning(PostEarning $postEarning): self
  552.     {
  553.         if ($this->postEarnings->removeElement($postEarning)) {
  554.             // set the owning side to null (unless already changed)
  555.             if ($postEarning->getPost() === $this) {
  556.                 $postEarning->setPost(null);
  557.             }
  558.         }
  559.         return $this;
  560.     }
  561. }