src/Entity/Program/Program.php line 22

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Program;
  3. use App\Entity\BaseEntity;
  4. use App\Entity\Chats;
  5. use App\Entity\Finance\ProgramEarning;
  6. use App\Entity\Media\Media;
  7. use App\Entity\Post\Post;
  8. use App\Entity\Shortcut;
  9. use App\Entity\SocialMedia;
  10. use App\Entity\User;
  11. use Doctrine\Common\Collections\ArrayCollection;
  12. use Doctrine\Common\Collections\Collection;
  13. use Doctrine\ORM\Mapping as ORM;
  14. /**
  15.  * @ORM\Entity(repositoryClass="App\Repository\Program\ProgramRepository")
  16.  * @ORM\HasLifecycleCallbacks()
  17.  */
  18. class Program extends BaseEntity
  19. {
  20.     /**
  21.      * @ORM\Column(type="boolean")
  22.      */
  23.     private $isSuspended;
  24.     private $logoFile;
  25.     /**
  26.      * @ORM\Column(type="string", length=255, nullable=true)
  27.      */
  28.     private $logo;
  29.     /**
  30.      * @ORM\Column(type="string", length=255)
  31.      */
  32.     private $name;
  33.     /**
  34.      * @ORM\Column(type="text", nullable=true)
  35.      */
  36.     private $about;
  37.     /**
  38.      * @ORM\Column(type="string", length=255, nullable=false, unique=true)
  39.      */
  40.     private $url;
  41.     /**
  42.      * @ORM\Column(type="text", nullable=true)
  43.      */
  44.     private $dynamicLink;
  45.     /**
  46.      * @ORM\Column(type="string", length=255, nullable=true)
  47.      */
  48.     private $shortDynamicLink;
  49.     /**
  50.      * Stable, fixed-length payload broadcast through the ultrasonic XR channel.
  51.      *
  52.      * @ORM\Column(type="string", length=16, nullable=true, unique=true)
  53.      */
  54.     private $xrCode;
  55.     /**
  56.      * @ORM\Column(type="string", length=255, nullable=true)
  57.      */
  58.     private $website;
  59.     /**
  60.      * @ORM\Column(type="string", length=255, nullable=true)
  61.      */
  62.     private $tel;
  63.     /**
  64.      * @ORM\Column(type="string", length=255, nullable=true)
  65.      */
  66.     private $email;
  67.     /**
  68.      * @ORM\Column(type="string", length=255, nullable=false)
  69.      */
  70.     private $genre;
  71.     /**
  72.      * @ORM\Column(type="json", length=255, nullable=true)
  73.      */
  74.     private $languages;
  75.     /**
  76.      * @ORM\ManyToOne(targetEntity="App\Entity\Media\Media",inversedBy="programs")
  77.      * @ORM\JoinColumn(onDelete="CASCADE", nullable=false)
  78.      */
  79.     private $media;
  80.     //Champ pour timing
  81.     /**
  82.      * @ORM\Column(type="boolean")
  83.      */
  84.     private $is24h;
  85.     /**
  86.      * @ORM\Column(type="time", nullable=true)
  87.      */
  88.     private $timeFrom;
  89.     /**
  90.      * @ORM\Column(type="time", nullable=true)
  91.      */
  92.     private $timeTo;
  93.     /**
  94.      * @ORM\Column(type="json")
  95.      */
  96.     private $day;
  97.     /**
  98.      * @ORM\Column(type="date")
  99.      */
  100.     private $dateFrom;
  101.     /**
  102.      * @ORM\Column(type="date", nullable=true)
  103.      */
  104.     private $dateTo;
  105.     /**
  106.      * @ORM\OneToMany(targetEntity="App\Entity\Program\ProgramCrewMember",mappedBy="program",cascade={"persist"})
  107.      */
  108.     private $crews;
  109.     /**
  110.      * @ORM\OneToOne(targetEntity="App\Entity\SocialMedia", inversedBy="program", cascade={"persist"})
  111.      */
  112.     private $socialMedia;
  113.     /**
  114.      * @ORM\OneToMany(targetEntity="App\Entity\Post\Post",mappedBy="program",cascade={"persist"})
  115.      */
  116.     private $posts;
  117.     // TOBE deleted
  118.     /**
  119.      * @ORM\Column(type="integer")
  120.      */
  121.     private $nbrFollowers;
  122.     public $isFollowed;
  123.     public $nbrPosts;
  124.     /**
  125.      * @ORM\Column(type="integer", options={"default" : 0})
  126.      */
  127.     public $score;
  128.     /**
  129.      * @ORM\OneToMany(targetEntity="App\Entity\Chats",mappedBy="program",cascade={"persist"})
  130.      */
  131.     private $chats;
  132.     /**
  133.      * @ORM\Column(type="integer", options={"default" : 0})
  134.      */
  135.     private $numberChatsNonLu;
  136.     public $isInShortCut;
  137.     /**
  138.      * @ORM\Column(type="integer")
  139.      */
  140.     public $numberParticipation;
  141.     /**
  142.      * @ORM\OneToMany(targetEntity=Shortcut::class, mappedBy="program")
  143.      */
  144.     private $shortcuts;
  145.     /**
  146.      * @ORM\ManyToOne(targetEntity="App\Entity\User")
  147.      */
  148.     private $createdBy;
  149.     /**
  150.      * @ORM\OneToMany(targetEntity="App\Entity\Finance\ProgramEarning",mappedBy="program",cascade={"persist"})
  151.      */
  152.     private $programEarnings;
  153.     public function __construct()
  154.     {
  155.         $this->isSuspended false;
  156.         $this->posts = new ArrayCollection();
  157.         $this->day = [];
  158.         $this->logo "logo-default.png";
  159.         $this->nbrFollowers 0;
  160.         $this->crews = new ArrayCollection();
  161.         $this->score 0;
  162.         $this->chats = new ArrayCollection();
  163.         $this->numberChatsNonLu 0;
  164.         $this->numberParticipation 0;
  165.         $this->shortcuts = new ArrayCollection();
  166.         $this->programEarnings = new ArrayCollection();
  167.     }
  168.     public function __toString()
  169.     {
  170.         return $this->name;
  171.     }
  172.     public function getId(): ?int
  173.     {
  174.         return $this->id;
  175.     }
  176.     public function getName(): ?string
  177.     {
  178.         return $this->name;
  179.     }
  180.     public function setName(string $name): self
  181.     {
  182.         $this->name $name;
  183.         return $this;
  184.     }
  185.     public function getAbout(): ?string
  186.     {
  187.         return $this->about;
  188.     }
  189.     public function setAbout(?string $about): self
  190.     {
  191.         $this->about $about;
  192.         return $this;
  193.     }
  194.     public function getUrl(): ?string
  195.     {
  196.         return $this->url;
  197.     }
  198.     public function setUrl(string $url): self
  199.     {
  200.         $this->url $url;
  201.         return $this;
  202.     }
  203.     public function getWebsite(): ?string
  204.     {
  205.         return $this->website;
  206.     }
  207.     public function setWebsite(string $website): self
  208.     {
  209.         $this->website $website;
  210.         return $this;
  211.     }
  212.     public function getTel(): ?string
  213.     {
  214.         return $this->tel;
  215.     }
  216.     public function setTel(string $tel): self
  217.     {
  218.         $this->tel $tel;
  219.         return $this;
  220.     }
  221.     public function getDateFrom(): ?\DateTimeInterface
  222.     {
  223.         return $this->dateFrom;
  224.     }
  225.     public function setDateFrom(\DateTimeInterface $dateFrom): self
  226.     {
  227.         $this->dateFrom $dateFrom;
  228.         return $this;
  229.     }
  230.     public function getDateTo(): ?\DateTimeInterface
  231.     {
  232.         return $this->dateTo;
  233.     }
  234.     public function setDateTo(\DateTimeInterface $dateTo): self
  235.     {
  236.         $this->dateTo $dateTo;
  237.         return $this;
  238.     }
  239.     public function getMedia(): ?Media
  240.     {
  241.         return $this->media;
  242.     }
  243.     public function setMedia(?Media $media): self
  244.     {
  245.         $this->media $media;
  246.         return $this;
  247.     }
  248.     public function getSocialMedia(): ?SocialMedia
  249.     {
  250.         return $this->socialMedia;
  251.     }
  252.     public function setSocialMedia(?SocialMedia $socialMedia): self
  253.     {
  254.         $this->socialMedia $socialMedia;
  255.         return $this;
  256.     }
  257.     /**
  258.      * @return Collection|Post[]
  259.      */
  260.     public function getPosts(): Collection
  261.     {
  262.         return $this->posts;
  263.     }
  264.     public function addPost(Post $post): self
  265.     {
  266.         if (!$this->posts->contains($post)) {
  267.             $this->posts[] = $post;
  268.             $post->setProgram($this);
  269.         }
  270.         return $this;
  271.     }
  272.     public function removePost(Post $post): self
  273.     {
  274.         if ($this->posts->contains($post)) {
  275.             $this->posts->removeElement($post);
  276.             // set the owning side to null (unless already changed)
  277.             if ($post->getProgram() === $this) {
  278.                 $post->setProgram(null);
  279.             }
  280.         }
  281.         return $this;
  282.     }
  283.     public function getEmail(): ?string
  284.     {
  285.         return $this->email;
  286.     }
  287.     public function setEmail(string $email): self
  288.     {
  289.         $this->email $email;
  290.         return $this;
  291.     }
  292.     public function getDay(): ?array
  293.     {
  294.         return $this->day;
  295.     }
  296.     public function setDay(array $day): self
  297.     {
  298.         $this->day $day;
  299.         return $this;
  300.     }
  301.     public function getLanguages(): ?array
  302.     {
  303.         return $this->languages;
  304.     }
  305.     public function setLanguages(?array $languages): self
  306.     {
  307.         $this->languages $languages;
  308.         return $this;
  309.     }
  310.     public function getIs24h(): ?bool
  311.     {
  312.         return $this->is24h;
  313.     }
  314.     public function setIs24h(bool $is24h): self
  315.     {
  316.         $this->is24h $is24h;
  317.         return $this;
  318.     }
  319.     public function getLogo(): ?string
  320.     {
  321.         return $this->logo;
  322.     }
  323.     public function setLogo(?string $logo): self
  324.     {
  325.         $this->logo $logo;
  326.         return $this;
  327.     }
  328.     public function getNbrFollowers(): ?int
  329.     {
  330.         return $this->nbrFollowers;
  331.     }
  332.     public function setNbrFollowers(int $nbrFollowers): self
  333.     {
  334.         $this->nbrFollowers $nbrFollowers;
  335.         return $this;
  336.     }
  337.     /**
  338.      * @return Collection|ProgramCrewMember[]
  339.      */
  340.     public function getCrews(): Collection
  341.     {
  342.         return $this->crews;
  343.     }
  344.     public function addCrew(ProgramCrewMember $crew): self
  345.     {
  346.         if (!$this->crews->contains($crew)) {
  347.             $this->crews[] = $crew;
  348.             $crew->setProgram($this);
  349.         }
  350.         return $this;
  351.     }
  352.     public function removeCrew(ProgramCrewMember $crew): self
  353.     {
  354.         if ($this->crews->contains($crew)) {
  355.             $this->crews->removeElement($crew);
  356.             // set the owning side to null (unless already changed)
  357.             if ($crew->getProgram() === $this) {
  358.                 $crew->setProgram(null);
  359.             }
  360.         }
  361.         return $this;
  362.     }
  363.     public function getTimeFrom(): ?\DateTimeInterface
  364.     {
  365.         return $this->timeFrom;
  366.     }
  367.     public function setTimeFrom(?\DateTimeInterface $timeFrom): self
  368.     {
  369.         $this->timeFrom $timeFrom;
  370.         return $this;
  371.     }
  372.     public function getTimeTo(): ?\DateTimeInterface
  373.     {
  374.         return $this->timeTo;
  375.     }
  376.     public function setTimeTo(?\DateTimeInterface $timeTo): self
  377.     {
  378.         $this->timeTo $timeTo;
  379.         return $this;
  380.     }
  381.     public function getScore(): ?int
  382.     {
  383.         return $this->score;
  384.     }
  385.     public function setScore(int $score): self
  386.     {
  387.         $this->score $score;
  388.         return $this;
  389.     }
  390.     /**
  391.      * @return Collection|Chats[]
  392.      */
  393.     public function getChats(): Collection
  394.     {
  395.         return $this->chats;
  396.     }
  397.     public function addChat(Chats $chat): self
  398.     {
  399.         if (!$this->chats->contains($chat)) {
  400.             $this->chats[] = $chat;
  401.             $chat->setMedia($this);
  402.         }
  403.         return $this;
  404.     }
  405.     public function removeChat(Chats $chat): self
  406.     {
  407.         if ($this->chats->removeElement($chat)) {
  408.             // set the owning side to null (unless already changed)
  409.             if ($chat->getMedia() === $this) {
  410.                 $chat->setMedia(null);
  411.             }
  412.         }
  413.         return $this;
  414.     }
  415.     public function getNumberChatsNonLu(): ?int
  416.     {
  417.         return $this->numberChatsNonLu;
  418.     }
  419.     public function setNumberChatsNonLu(int $numberChatsNonLu): self
  420.     {
  421.         $this->numberChatsNonLu $numberChatsNonLu;
  422.         return $this;
  423.     }
  424.     public function getIsSuspended(): ?bool
  425.     {
  426.         return $this->isSuspended;
  427.     }
  428.     public function setIsSuspended(bool $isSuspended): self
  429.     {
  430.         $this->isSuspended $isSuspended;
  431.         return $this;
  432.     }
  433.     /**
  434.      * @return Collection|Shortcut[]
  435.      */
  436.     public function getShortcuts(): Collection
  437.     {
  438.         return $this->shortcuts;
  439.     }
  440.     public function addShortcut(Shortcut $shortcut): self
  441.     {
  442.         if (!$this->shortcuts->contains($shortcut)) {
  443.             $this->shortcuts[] = $shortcut;
  444.             $shortcut->setProgram($this);
  445.         }
  446.         return $this;
  447.     }
  448.     public function removeShortcut(Shortcut $shortcut): self
  449.     {
  450.         if ($this->shortcuts->removeElement($shortcut)) {
  451.             // set the owning side to null (unless already changed)
  452.             if ($shortcut->getProgram() === $this) {
  453.                 $shortcut->setProgram(null);
  454.             }
  455.         }
  456.         return $this;
  457.     }
  458.     public function getGenre(): ?string
  459.     {
  460.         return $this->genre;
  461.     }
  462.     public function setGenre(?string $genre): self
  463.     {
  464.         $this->genre $genre;
  465.         return $this;
  466.     }
  467.     public function getNumberParticipation(): ?int
  468.     {
  469.         return $this->numberParticipation;
  470.     }
  471.     public function setNumberParticipation(int $numberParticipation): self
  472.     {
  473.         $this->numberParticipation $numberParticipation;
  474.         return $this;
  475.     }
  476.     public function getDynamicLink(): ?string
  477.     {
  478.         return $this->dynamicLink;
  479.     }
  480.     public function setDynamicLink(?string $dynamicLink): self
  481.     {
  482.         $this->dynamicLink $dynamicLink;
  483.         return $this;
  484.     }
  485.     public function getShortDynamicLink(): ?string
  486.     {
  487.         return $this->shortDynamicLink;
  488.     }
  489.     public function setShortDynamicLink(?string $shortDynamicLink): self
  490.     {
  491.         $this->shortDynamicLink $shortDynamicLink;
  492.         return $this;
  493.     }
  494.     public function getXrCode(): ?string
  495.     {
  496.         return $this->xrCode;
  497.     }
  498.     public function setXrCode(?string $xrCode): self
  499.     {
  500.         $this->xrCode $xrCode;
  501.         return $this;
  502.     }
  503.     public function getCreatedBy(): ?User
  504.     {
  505.         return $this->createdBy;
  506.     }
  507.     public function setCreatedBy(?User $createdBy): self
  508.     {
  509.         $this->createdBy $createdBy;
  510.         return $this;
  511.     }
  512.     /**
  513.      * @return Collection|ProgramEarning[]
  514.      */
  515.     public function getProgramEarnings(): Collection
  516.     {
  517.         return $this->programEarnings;
  518.     }
  519.     public function addProgramEarning(ProgramEarning $programEarning): self
  520.     {
  521.         if (!$this->programEarnings->contains($programEarning)) {
  522.             $this->programEarnings[] = $programEarning;
  523.             $programEarning->setProgram($this);
  524.         }
  525.         return $this;
  526.     }
  527.     public function removeProgramEarning(ProgramEarning $programEarning): self
  528.     {
  529.         if ($this->programEarnings->removeElement($programEarning)) {
  530.             // set the owning side to null (unless already changed)
  531.             if ($programEarning->getProgram() === $this) {
  532.                 $programEarning->setProgram(null);
  533.             }
  534.         }
  535.         return $this;
  536.     }
  537. }