<?php
namespace App\Entity\Program;
use App\Entity\BaseEntity;
use App\Entity\Chats;
use App\Entity\Finance\ProgramEarning;
use App\Entity\Media\Media;
use App\Entity\Post\Post;
use App\Entity\Shortcut;
use App\Entity\SocialMedia;
use App\Entity\User;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="App\Repository\Program\ProgramRepository")
* @ORM\HasLifecycleCallbacks()
*/
class Program extends BaseEntity
{
/**
* @ORM\Column(type="boolean")
*/
private $isSuspended;
private $logoFile;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $logo;
/**
* @ORM\Column(type="string", length=255)
*/
private $name;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $about;
/**
* @ORM\Column(type="string", length=255, nullable=false, unique=true)
*/
private $url;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $dynamicLink;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $shortDynamicLink;
/**
* Stable, fixed-length payload broadcast through the ultrasonic XR channel.
*
* @ORM\Column(type="string", length=16, nullable=true, unique=true)
*/
private $xrCode;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $website;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $tel;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $email;
/**
* @ORM\Column(type="string", length=255, nullable=false)
*/
private $genre;
/**
* @ORM\Column(type="json", length=255, nullable=true)
*/
private $languages;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Media\Media",inversedBy="programs")
* @ORM\JoinColumn(onDelete="CASCADE", nullable=false)
*/
private $media;
//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")
*/
private $day;
/**
* @ORM\Column(type="date")
*/
private $dateFrom;
/**
* @ORM\Column(type="date", nullable=true)
*/
private $dateTo;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Program\ProgramCrewMember",mappedBy="program",cascade={"persist"})
*/
private $crews;
/**
* @ORM\OneToOne(targetEntity="App\Entity\SocialMedia", inversedBy="program", cascade={"persist"})
*/
private $socialMedia;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Post\Post",mappedBy="program",cascade={"persist"})
*/
private $posts;
// TOBE deleted
/**
* @ORM\Column(type="integer")
*/
private $nbrFollowers;
public $isFollowed;
public $nbrPosts;
/**
* @ORM\Column(type="integer", options={"default" : 0})
*/
public $score;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Chats",mappedBy="program",cascade={"persist"})
*/
private $chats;
/**
* @ORM\Column(type="integer", options={"default" : 0})
*/
private $numberChatsNonLu;
public $isInShortCut;
/**
* @ORM\Column(type="integer")
*/
public $numberParticipation;
/**
* @ORM\OneToMany(targetEntity=Shortcut::class, mappedBy="program")
*/
private $shortcuts;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\User")
*/
private $createdBy;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Finance\ProgramEarning",mappedBy="program",cascade={"persist"})
*/
private $programEarnings;
public function __construct()
{
$this->isSuspended = false;
$this->posts = new ArrayCollection();
$this->day = [];
$this->logo = "logo-default.png";
$this->nbrFollowers = 0;
$this->crews = new ArrayCollection();
$this->score = 0;
$this->chats = new ArrayCollection();
$this->numberChatsNonLu = 0;
$this->numberParticipation = 0;
$this->shortcuts = new ArrayCollection();
$this->programEarnings = new ArrayCollection();
}
public function __toString()
{
return $this->name;
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getAbout(): ?string
{
return $this->about;
}
public function setAbout(?string $about): self
{
$this->about = $about;
return $this;
}
public function getUrl(): ?string
{
return $this->url;
}
public function setUrl(string $url): self
{
$this->url = $url;
return $this;
}
public function getWebsite(): ?string
{
return $this->website;
}
public function setWebsite(string $website): self
{
$this->website = $website;
return $this;
}
public function getTel(): ?string
{
return $this->tel;
}
public function setTel(string $tel): self
{
$this->tel = $tel;
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 getMedia(): ?Media
{
return $this->media;
}
public function setMedia(?Media $media): self
{
$this->media = $media;
return $this;
}
public function getSocialMedia(): ?SocialMedia
{
return $this->socialMedia;
}
public function setSocialMedia(?SocialMedia $socialMedia): self
{
$this->socialMedia = $socialMedia;
return $this;
}
/**
* @return Collection|Post[]
*/
public function getPosts(): Collection
{
return $this->posts;
}
public function addPost(Post $post): self
{
if (!$this->posts->contains($post)) {
$this->posts[] = $post;
$post->setProgram($this);
}
return $this;
}
public function removePost(Post $post): self
{
if ($this->posts->contains($post)) {
$this->posts->removeElement($post);
// set the owning side to null (unless already changed)
if ($post->getProgram() === $this) {
$post->setProgram(null);
}
}
return $this;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(string $email): self
{
$this->email = $email;
return $this;
}
public function getDay(): ?array
{
return $this->day;
}
public function setDay(array $day): self
{
$this->day = $day;
return $this;
}
public function getLanguages(): ?array
{
return $this->languages;
}
public function setLanguages(?array $languages): self
{
$this->languages = $languages;
return $this;
}
public function getIs24h(): ?bool
{
return $this->is24h;
}
public function setIs24h(bool $is24h): self
{
$this->is24h = $is24h;
return $this;
}
public function getLogo(): ?string
{
return $this->logo;
}
public function setLogo(?string $logo): self
{
$this->logo = $logo;
return $this;
}
public function getNbrFollowers(): ?int
{
return $this->nbrFollowers;
}
public function setNbrFollowers(int $nbrFollowers): self
{
$this->nbrFollowers = $nbrFollowers;
return $this;
}
/**
* @return Collection|ProgramCrewMember[]
*/
public function getCrews(): Collection
{
return $this->crews;
}
public function addCrew(ProgramCrewMember $crew): self
{
if (!$this->crews->contains($crew)) {
$this->crews[] = $crew;
$crew->setProgram($this);
}
return $this;
}
public function removeCrew(ProgramCrewMember $crew): self
{
if ($this->crews->contains($crew)) {
$this->crews->removeElement($crew);
// set the owning side to null (unless already changed)
if ($crew->getProgram() === $this) {
$crew->setProgram(null);
}
}
return $this;
}
public function getTimeFrom(): ?\DateTimeInterface
{
return $this->timeFrom;
}
public function setTimeFrom(?\DateTimeInterface $timeFrom): self
{
$this->timeFrom = $timeFrom;
return $this;
}
public function getTimeTo(): ?\DateTimeInterface
{
return $this->timeTo;
}
public function setTimeTo(?\DateTimeInterface $timeTo): self
{
$this->timeTo = $timeTo;
return $this;
}
public function getScore(): ?int
{
return $this->score;
}
public function setScore(int $score): self
{
$this->score = $score;
return $this;
}
/**
* @return Collection|Chats[]
*/
public function getChats(): Collection
{
return $this->chats;
}
public function addChat(Chats $chat): self
{
if (!$this->chats->contains($chat)) {
$this->chats[] = $chat;
$chat->setMedia($this);
}
return $this;
}
public function removeChat(Chats $chat): self
{
if ($this->chats->removeElement($chat)) {
// set the owning side to null (unless already changed)
if ($chat->getMedia() === $this) {
$chat->setMedia(null);
}
}
return $this;
}
public function getNumberChatsNonLu(): ?int
{
return $this->numberChatsNonLu;
}
public function setNumberChatsNonLu(int $numberChatsNonLu): self
{
$this->numberChatsNonLu = $numberChatsNonLu;
return $this;
}
public function getIsSuspended(): ?bool
{
return $this->isSuspended;
}
public function setIsSuspended(bool $isSuspended): self
{
$this->isSuspended = $isSuspended;
return $this;
}
/**
* @return Collection|Shortcut[]
*/
public function getShortcuts(): Collection
{
return $this->shortcuts;
}
public function addShortcut(Shortcut $shortcut): self
{
if (!$this->shortcuts->contains($shortcut)) {
$this->shortcuts[] = $shortcut;
$shortcut->setProgram($this);
}
return $this;
}
public function removeShortcut(Shortcut $shortcut): self
{
if ($this->shortcuts->removeElement($shortcut)) {
// set the owning side to null (unless already changed)
if ($shortcut->getProgram() === $this) {
$shortcut->setProgram(null);
}
}
return $this;
}
public function getGenre(): ?string
{
return $this->genre;
}
public function setGenre(?string $genre): self
{
$this->genre = $genre;
return $this;
}
public function getNumberParticipation(): ?int
{
return $this->numberParticipation;
}
public function setNumberParticipation(int $numberParticipation): self
{
$this->numberParticipation = $numberParticipation;
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 getXrCode(): ?string
{
return $this->xrCode;
}
public function setXrCode(?string $xrCode): self
{
$this->xrCode = $xrCode;
return $this;
}
public function getCreatedBy(): ?User
{
return $this->createdBy;
}
public function setCreatedBy(?User $createdBy): self
{
$this->createdBy = $createdBy;
return $this;
}
/**
* @return Collection|ProgramEarning[]
*/
public function getProgramEarnings(): Collection
{
return $this->programEarnings;
}
public function addProgramEarning(ProgramEarning $programEarning): self
{
if (!$this->programEarnings->contains($programEarning)) {
$this->programEarnings[] = $programEarning;
$programEarning->setProgram($this);
}
return $this;
}
public function removeProgramEarning(ProgramEarning $programEarning): self
{
if ($this->programEarnings->removeElement($programEarning)) {
// set the owning side to null (unless already changed)
if ($programEarning->getProgram() === $this) {
$programEarning->setProgram(null);
}
}
return $this;
}
}