src/Entity/Channel.php line 98

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Core\Annotation\ApiFilter;
  4. use ApiPlatform\Core\Annotation\ApiResource;
  5. use ApiPlatform\Core\Annotation\ApiSubresource;
  6. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\ExistsFilter;
  7. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\OrderFilter;
  8. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter;
  9. use ApiPlatform\Core\Serializer\Filter\GroupFilter;
  10. use ApiPlatform\Core\Serializer\Filter\PropertyFilter;
  11. use App\Annotation\CompanyCustomizable;
  12. use App\Annotation\Exclusions;
  13. use App\Repository\ChannelRepository;
  14. use Doctrine\Common\Collections\ArrayCollection;
  15. use Doctrine\Common\Collections\Collection;
  16. use Doctrine\ORM\Mapping as ORM;
  17. use Gedmo\Mapping\Annotation as Gedmo;
  18. use Symfony\Component\HttpFoundation\File\UploadedFile;
  19. use Symfony\Component\Serializer\Annotation\Groups;
  20. use Symfony\Component\Validator\Constraints as Assert;
  21. /**
  22.  * @ORM\Entity(repositoryClass=ChannelRepository::class)
  23.  * @ApiResource(
  24.  *     normalizationContext={"groups"={"channel:read"}},
  25.  *     denormalizationContext={"groups"={"channel:write"}},
  26.  *     collectionOperations={
  27.  *          "get"={
  28.  *              "security"="is_granted('ROLE_USER')"
  29.  *          }, 
  30.  *          "post"={
  31.  *              "security"="is_granted('ROLE_USER')"
  32.  *          },
  33.  *          "custom_add_remove_video_program_thematic_channel"={
  34.  *             "description"="Add video to playlist's channel",
  35.  *             "path"="/custom/playlist_channel/{action}/{slug}",
  36.  *             "method"="POST",
  37.  *             "controller"="App\Controller\Api\ChannelController::customAddOrRemoveVideoProgramThematicChannel",
  38.  *             "deserialize"=false,
  39.  *             "security"="is_granted('ROLE_USER')"
  40.  *          },
  41.  *          "post_update"={
  42.  *              "security"="is_granted('ROLE_USER')",
  43.  *              "path"="/channels/{id}",
  44.  *              "description"="Update a Channel with method POST (using content-type: 'multipart')",
  45.  *              "method"="POST",
  46.  *              "controller"="App\Controller\Api\ChannelController::update"
  47.  *          },
  48.  *          "vitality_balance_recommended_channels_by_client"={
  49.  *             "description"="Get vitality balance recommended channels by client.",
  50.  *             "path"="/clients/{id}/vitality-balance/recommended-channels",
  51.  *             "method"="GET",
  52.  *             "controller"="App\Controller\Api\VitalityBalanceController::getVitalityBalanceRecommandedChannelsByClient",
  53.  *             "security"="is_granted('ROLE_CLIENT')"
  54.  *          },
  55.  *          "vitality_balance_recommended_express_programs_by_client"={
  56.  *             "description"="Get vitality balance recommended express_programs by client.",
  57.  *             "path"="/clients/{id}/vitality-balance/recommended-express-programs",
  58.  *             "method"="GET",
  59.  *             "controller"="App\Controller\Api\VitalityBalanceController::getVitalityBalanceRecommandedExpressProgramsByClient",
  60.  *             "security"="is_granted('ROLE_CLIENT')"
  61.  *          }
  62.  *     },
  63.  *     itemOperations={
  64.  *          "get"={
  65.  *              "security"="is_granted('ROLE_USER')"
  66.  *          },
  67.  *          "delete"={
  68.  *              "security"="is_granted('ROLE_USER')"
  69.  *          },
  70.  *          "patch"={
  71.  *              "security"="is_granted('ROLE_USER')"
  72.  *          }
  73.  *      }
  74.  * )
  75.  * @ApiFilter(GroupFilter::class, arguments={
  76.  *      "parameterName": "groups", 
  77.  *      "overrideDefaultGroups": true
  78.  * })
  79.  * @ApiFilter(SearchFilter::class, properties={
  80.  *      "name": "partial", "active", "isThematic",
  81.  *      "tvCompany.id": "exact", "tvCompany.name": "partial", "tvUser.id": "exact", "category.id": "exact", 
  82.  *      "objectives.id": "exact"
  83.  * })
  84.  * @ApiFilter(ExistsFilter::class, properties={"tvUser", "category"})
  85.  * @ApiFilter(OrderFilter::class, properties={"id", "name", "active", "category.name"})
  86.  * @ApiFilter(PropertyFilter::class, 
  87.  *      arguments={
  88.  *          "parameterName"="fields", 
  89.  *          "overrideDefaultProperties"=true
  90.  *     }
  91.  * )
  92.  * @CompanyCustomizable
  93.  * @Exclusions(exclusionsClass="App\Entity\ExclusionsChannel", property="exclusions_channels")
  94.  */
  95. class Channel
  96. {
  97.     const VIDEO_TYPE 'video';
  98.     const RECIPE_TYPE 'recipe';
  99.     const AUDIO_TYPE 'audio';
  100.     const TYPES = [
  101.         self::VIDEO_TYPE,
  102.         self::RECIPE_TYPE,
  103.         self::AUDIO_TYPE
  104.     ];
  105.     /**
  106.      * @ORM\Id
  107.      * @ORM\GeneratedValue
  108.      * @ORM\Column(type="integer")
  109.      * @Groups({"channel:read", "channel:read:id", "homepage:read", "category:read", "stats", "slide:read", "day:read", "video:read",
  110.      *     "search_engine", "objective:read", "channel_list", "channel_form", "channel_form_simple", "program_express_list"})
  111.      */
  112.     private $id;
  113.     /**
  114.      * @ORM\Column(type="string", length=255)
  115.      * @Groups({"channel:read", "channel:read:name", "channel:write", "category:read", "stats", "slide:read", "homepage:read", "day:read",
  116.      *     "video:read", "search_engine", "objective:read", "channel_list", "program_single_list", "video_list", "channel_form",
  117.      *     "video_form_complete", "channel_form_simple", "objective_form_complete", "answer_recommended_objectives_edit", "program_express_list"})
  118.      * @Assert\NotBlank(message="channel.name")
  119.      */
  120.     private $name;
  121.     /**
  122.      * @ORM\Column(type="boolean", options={"default": "1"})
  123.      * @Groups({"channel:read", "channel:read:active", "channel:write", "search_engine", "objective:read", "channel_list", "program_express_list"})
  124.      */
  125.     private $active true;
  126.     /**
  127.      * @ORM\Column(type="text")
  128.      * @Groups({"channel:read", "channel:read:content", "channel:write", "slide:read", "category:read", "search_engine", "objective:read", "program_express_list"})
  129.      */
  130.     private $content;
  131.     /**
  132.      * @ORM\ManyToOne(targetEntity=Category::class, inversedBy="channels")
  133.      * @ORM\JoinColumn(nullable=true)
  134.      * @Groups({"channel:read", "channel:read:category", "channel:write", "search_engine", "objective:read", "slide:read", "channel_list", "program_express_list"})
  135.      */
  136.     private $category;
  137.     /**
  138.      * @ORM\ManyToOne(targetEntity=Playlist::class, inversedBy="channels", cascade={"persist", "refresh", "remove"})
  139.      * @ORM\JoinColumn(nullable=false)
  140.      * @Groups({"homepage:read", "single_channel:read", "channel:read", "channel:read:playlist", "video:read", "search_engine", "objective:read", "channel_form"})
  141.      * @Assert\NotNull(message="channel.playlist")
  142.      * @ApiSubresource(maxDepth=1)
  143.      */
  144.     private $playlist;
  145.     /**
  146.      * @ORM\OneToMany(targetEntity=Slide::class, mappedBy="channel")
  147.      */
  148.     private $slides;
  149.     /**
  150.      * This is used for the customisation in the login page
  151.      * @ORM\ManyToOne(targetEntity=MediaObject::class)
  152.      * @Groups({"channel:read", "channel:read:image", "channel:write", "slide:read", "category:read", "stats", "search_engine", "objective:read", "program_express_list"})
  153.      */
  154.     private $image;
  155.     /**
  156.      * @ORM\ManyToOne(targetEntity=TvCompany::class, inversedBy="channels")
  157.      */
  158.     private $tvCompany;
  159.     /**
  160.      * @ORM\ManyToOne(targetEntity=Company::class, inversedBy="channels")
  161.      * @Groups({"channel:read", "channel:write"})
  162.      */
  163.     private $company;
  164.     /**
  165.      * @ORM\ManyToOne(targetEntity=Channel::class, inversedBy="children")
  166.      */
  167.     private $parent;
  168.     /**
  169.      * @ORM\OneToMany(targetEntity=Channel::class, mappedBy="parent")
  170.      */
  171.     private $children;
  172.     /**
  173.      * @ORM\Column(type="boolean", options={"default": "0"})
  174.      * @Groups({"channel:read", "channel:read:emptyChannel", "channel:write", "category:read", "stats", "slide:read", "homepage:read", "day:read", "search_engine", "objective:read"})
  175.      */
  176.     private $emptyChannel false;
  177.     /**
  178.      * @ORM\Column(type="boolean", options={"default": "0"})
  179.      * @Groups({"channel:read", "channel:read:isThematic", "channel:write", "category:read", "stats", "slide:read", "homepage:read", "day:read", "search_engine", "objective:read"})
  180.      */
  181.     private $isThematic false;
  182.     /**
  183.      * @ORM\OneToMany(targetEntity=ExclusionsChannel::class, mappedBy="channel", cascade={"persist", "refresh", "remove"}, orphanRemoval=true)
  184.      * @Groups({"channel:read", "channel:read:exclusionsChannels", "channel:write"})
  185.      */
  186.     private $exclusionsChannels;
  187.     /**
  188.      * @ORM\Column(type="text", nullable=true)
  189.      * @Groups({"channel:read", "channel:read:contentPlaylist", "channel:write", "slide:read", "category:read", "search_engine", "objective:read"})
  190.      */
  191.     private $contentPlaylist;
  192.     /**
  193.      * @ORM\ManyToMany(targetEntity=FiltersCategory::class, mappedBy="channels")
  194.      * @Groups({"channel:read", "channel:read:filtersCategories", "channel:write", "category:read", "search_engine", "objective:read"})
  195.      */
  196.     private $filtersCategories;
  197.     /**
  198.      * @ORM\ManyToOne(targetEntity=TvUser::class, inversedBy="channels")
  199.      */
  200.     private $tvUser;
  201.     /**
  202.      * @var array
  203.      * @Groups({"channel:read", "channel:read:moodAfterPostResponses"})
  204.      */
  205.     public $moodAfterPostResponses null;
  206.     /**
  207.      * @ORM\Column(name="`rank`", type="integer")
  208.      * @Groups({"channel:read", "channel:read:rank", "channel:write", "category:read", "stats", "slide:read", "homepage:read", "day:read",
  209.      *     "search_engine", "objective:read", "channel_list"})
  210.      */
  211.     private $rank;
  212.     /**
  213.      * @Groups({"channel:read", "channel:read:flags", "slide:read", "category:read", "search_engine", "objective:read"})
  214.      */
  215.     public $flags null;
  216.     /**
  217.      * @ORM\Column(type="datetime")
  218.      * @Gedmo\Timestampable(on="create")
  219.      * @Groups({"channel:read", "channel:read:createdAt", "channel:write", "slide:read", "category:read", "search_engine", "objective:read"})
  220.      */
  221.     private $createdAt;
  222.     /**
  223.      * @ORM\Column(type="string", length=255, nullable=true)
  224.      * @Groups({"channel:read", "channel:read:thematicMotivationEndPhrase", "channel:write", "category:read", "search_engine", "objective:read"})
  225.      */
  226.     private $thematicMotivationEndPhrase;
  227.     /**
  228.      * @ORM\Column(type="string", length=255, nullable=true)
  229.      * @Groups({"channel:read", "channel:read:type", "channel:write", "slide:read", "category:read", "search_engine", "objective:read"})
  230.      * @Assert\Choice(choices=self::TYPES)
  231.      */
  232.     private $type;
  233.     /**
  234.      * @var int
  235.      * @Groups({"channel:read", "channel:read:videosCount", "slide:read", "channel_list", "program_express_list"})
  236.      */
  237.     private $videosCount 0;
  238.     /**
  239.      * @ORM\ManyToMany(targetEntity=TvTag::class)
  240.      * @Groups({"channel:read", "channel:read:tvTags", "channel:write"})
  241.      */
  242.     private $tvTags;
  243.     /**
  244.      * @ORM\Column(type="text", nullable=true)
  245.      * @Groups({"channel:read", "channel:read:stringifyTags"})
  246.      */
  247.     private $stringifyTags '';
  248.     /**
  249.      * @var bool
  250.      * @Groups({"channel:read", "channel:read:excluded", "slide:read", "channel_list"})
  251.      */
  252.     private $excluded false;
  253.     /**
  254.      * @ORM\OneToMany(targetEntity=Video::class, mappedBy="defaultChannel")
  255.      */
  256.     private $defaultVideos;
  257.     /**
  258.      * @ORM\ManyToMany(targetEntity=Objective::class, mappedBy="channels")
  259.      */
  260.     private $objectives;
  261.     /**
  262.      * @ORM\Column(type="boolean", options={"default": 0})
  263.      * @Groups({"channel:read", "channel:read:itCanInterrest", "channel:write"})
  264.      */
  265.     private $itCanInterrest false;
  266.     /**
  267.      * @ORM\Column(type="datetime", nullable=true)
  268.      * @Gedmo\Timestampable(on="update")
  269.      */
  270.     private $updatedAt;
  271.     /**
  272.      * @ORM\OneToMany(targetEntity=ProgramEvent::class, mappedBy="channel", cascade={"persist", "refresh", "remove"}, orphanRemoval=true)
  273.      */
  274.     private $programEvents;
  275.     /**
  276.      * Custom field isThematic = 1
  277.      * @var ?Video
  278.      * @Groups({"channel:read", "channel:read:currentVideo"})
  279.      */
  280.     public $currentVideo;
  281.     
  282.     /**
  283.      * Custom field isThematic = 1
  284.      * @var ?Video
  285.      * @Groups({"channel:read", "channel:read:previousVideo"})
  286.      */
  287.     public $previousVideo;
  288.     
  289.     /**
  290.      * Custom field isThematic = 1
  291.      * @var ?Video
  292.      * @Groups({"channel:read", "channel:read:nextVideo"})
  293.      */
  294.     public $nextVideo;
  295.     /**
  296.      * Custom field isThematic = 1
  297.      * @var ?int
  298.      * @Groups({"channel:read", "channel:read:nextVideo"})
  299.      */
  300.     public $videosCompletedCount 0;
  301.     public function __construct()
  302.     {
  303.         $this->playlist = new Playlist();
  304.         $this->active true;
  305.         $this->slides = new ArrayCollection();
  306.         $this->children = new ArrayCollection();
  307.         $this->isThematic false;
  308.         $this->exclusionsChannels = new ArrayCollection();
  309.         $this->filtersCategories = new ArrayCollection();
  310.         $this->emptyChannel false;
  311.         $this->content "";
  312.         $this->rank 999;
  313.         $this->thematicMotivationEndPhrase "";
  314.         $this->type null;
  315.         $this->tvTags = new ArrayCollection();
  316.         $this->defaultVideos = new ArrayCollection();
  317.         $this->objectives = new ArrayCollection();
  318.         $this->programEvents = new ArrayCollection();
  319.     }
  320.     public function getId(): ?int
  321.     {
  322.         return $this->id;
  323.     }
  324.     public function getName(): ?string
  325.     {
  326.         return $this->name;
  327.     }
  328.     public function setName(string $name): self
  329.     {
  330.         $this->name $name;
  331.         return $this;
  332.     }
  333.     public function getActive(): ?bool
  334.     {
  335.         return $this->active;
  336.     }
  337.     public function setActive(bool $active): self
  338.     {
  339.         $this->active $active;
  340.         return $this;
  341.     }
  342.     public function getContent(): ?string
  343.     {
  344.         return $this->content;
  345.     }
  346.     public function setContent(string $content): self
  347.     {
  348.         $this->content $content;
  349.         return $this;
  350.     }
  351.     public function getCategory(): ?Category
  352.     {
  353.         return $this->category;
  354.     }
  355.     public function setCategory(?Category $category): self
  356.     {
  357.         $this->category $category;
  358.         $this->setCompany($category->getCompany());
  359.         return $this;
  360.     }
  361.     public function getPlaylist(): ?Playlist
  362.     {
  363.         return $this->playlist;
  364.     }
  365.     public function setPlaylist(?Playlist $playlist): self
  366.     {
  367.         $this->playlist $playlist;
  368.         return $this;
  369.     }
  370.     /**
  371.      * @return Collection|Slide[]
  372.      */
  373.     public function getSlides(): Collection
  374.     {
  375.         return $this->slides;
  376.     }
  377.     public function addSlide(Slide $slide): self
  378.     {
  379.         if (!$this->slides->contains($slide)) {
  380.             $this->slides[] = $slide;
  381.             $slide->setChannel($this);
  382.         }
  383.         return $this;
  384.     }
  385.     public function removeSlide(Slide $slide): self
  386.     {
  387.         if ($this->slides->removeElement($slide)) {
  388.             // set the owning side to null (unless already changed)
  389.             if ($slide->getChannel() === $this) {
  390.                 $slide->setChannel(null);
  391.             }
  392.         }
  393.         return $this;
  394.     }
  395.     public function getTvCompany(): ?TvCompany
  396.     {
  397.         return $this->tvCompany;
  398.     }
  399.     public function setTvCompany(?TvCompany $tvCompany): self
  400.     {
  401.         $this->tvCompany $tvCompany;
  402.         return $this;
  403.     }
  404.     public function getCompany(): ?Company
  405.     {
  406.         return $this->company;
  407.     }
  408.     public function setCompany(?Company $company): self
  409.     {
  410.         $this->company $company;
  411.         return $this;
  412.     }
  413.     public function getParent(): ?self
  414.     {
  415.         return $this->parent;
  416.     }
  417.     public function setParent(?self $parent): self
  418.     {
  419.         $this->parent $parent;
  420.         return $this;
  421.     }
  422.     /**
  423.      * @return Collection|self[]
  424.      */
  425.     public function getChildren(): Collection
  426.     {
  427.         return $this->children;
  428.     }
  429.     public function addChild(self $child): self
  430.     {
  431.         if (!$this->children->contains($child)) {
  432.             $this->children[] = $child;
  433.             $child->setParent($this);
  434.         }
  435.         return $this;
  436.     }
  437.     public function removeChild(self $child): self
  438.     {
  439.         if ($this->children->removeElement($child)) {
  440.             // set the owning side to null (unless already changed)
  441.             if ($child->getParent() === $this) {
  442.                 $child->setParent(null);
  443.             }
  444.         }
  445.         return $this;
  446.     }
  447.     /**
  448.      *
  449.      */
  450.     public function getVideosCount(): int
  451.     {
  452.         return $this->videosCount;
  453.     }
  454.     /**
  455.      * @return mixed
  456.      */
  457.     public function getImage()
  458.     {
  459.         return $this->image;
  460.     }
  461.     /**
  462.      * @param mixed $image
  463.      * @return Channel
  464.      */
  465.     public function setImage($image): Channel
  466.     {
  467.         $this->image $image;
  468.         return $this;
  469.     }
  470.     /**
  471.      * @Groups({"channel:write"})
  472.      */
  473.     public function setImageFile($file null): self
  474.     {
  475.         if($file instanceof UploadedFile) {
  476.             $image = empty($this->image) ? new MediaObject $this->image;
  477.             $image->setFile($file);
  478.             $this->setImage($image);
  479.         }
  480.         return $this;
  481.     }
  482.     public function getEmptyChannel(): ?bool
  483.     {
  484.         return $this->emptyChannel;
  485.     }
  486.     public function setEmptyChannel(bool $emptyChannel): self
  487.     {
  488.         $this->emptyChannel $emptyChannel;
  489.         return $this;
  490.     }
  491.     public function getIsThematic(): ?bool
  492.     {
  493.         return $this->isThematic;
  494.     }
  495.     public function setIsThematic(bool $isThematic): self
  496.     {
  497.         $this->isThematic $isThematic;
  498.         return $this;
  499.     }
  500.     /**
  501.      * @return Collection|ExclusionsChannel[]
  502.      */
  503.     public function getExclusionsChannels(): Collection
  504.     {
  505.         return $this->exclusionsChannels;
  506.     }
  507.     public function addExclusionsChannel(ExclusionsChannel $exclusionsChannel): self
  508.     {
  509.         if (!$this->exclusionsChannels->contains($exclusionsChannel)) {
  510.             $this->exclusionsChannels[] = $exclusionsChannel;
  511.             $exclusionsChannel->setChannel($this);
  512.             // Ajout des Exclusions de toutes les Videos liées a cette Chaines
  513.             $playlist $this->getPlaylist();
  514.             if($playlist instanceof Playlist) {
  515.                 foreach($playlist->getVideos()->toArray() as $video) {
  516.                     $exclusionsVideo = new ExclusionsVideo;
  517.                     $exclusionsVideo
  518.                         ->setVideo($video)
  519.                         ->setCompany($exclusionsChannel->getCompany())
  520.                         ->setCreatedAt(new \DateTime());
  521.                     // Vérifier si il en existe pas deja un
  522.                     $video->addExclusionsVideo($exclusionsVideo);
  523.                 }
  524.             }
  525.         }
  526.         return $this;
  527.     }
  528.     public function removeExclusionsChannel(ExclusionsChannel $exclusionsChannel): self
  529.     {
  530.         if ($this->exclusionsChannels->removeElement($exclusionsChannel)) {
  531.             // set the owning side to null (unless already changed)
  532.             if ($exclusionsChannel->getChannel() === $this) {
  533.                 $exclusionsChannel->setChannel(null);
  534.                 // Retrait des Exclusion de toutes les Videos liées a cette Chaines
  535.                 $playlist $this->getPlaylist();
  536.                 if($playlist instanceof Playlist) {
  537.                     foreach($playlist->getVideos()->toArray() as $video) {
  538.                         foreach ($video->getExclusionsVideos()->toArray() as $exclusionsVideo) {
  539.                             if($exclusionsVideo->getCompany() === $exclusionsChannel->getCompany()) {
  540.                                 $video->removeExclusionsVideo($exclusionsVideo);
  541.                             }
  542.                         }
  543.                     }
  544.                 }
  545.             }
  546.         }
  547.         return $this;
  548.     }
  549.     public function getContentPlaylist(): ?string
  550.     {
  551.         return $this->contentPlaylist;
  552.     }
  553.     public function setContentPlaylist(?string $contentPlaylist): self
  554.     {
  555.         $this->contentPlaylist $contentPlaylist;
  556.         return $this;
  557.     }
  558.     /**
  559.      * @return Collection|FiltersCategory[]
  560.      */
  561.     public function getFiltersCategories(): Collection
  562.     {
  563.         return $this->filtersCategories;
  564.     }
  565.     public function addFiltersCategory(FiltersCategory $filtersCategory): self
  566.     {
  567.         if (!$this->filtersCategories->contains($filtersCategory)) {
  568.             $this->filtersCategories[] = $filtersCategory;
  569.             $filtersCategory->addChannel($this);
  570.         }
  571.         return $this;
  572.     }
  573.     public function removeFiltersCategory(FiltersCategory $filtersCategory): self
  574.     {
  575.         if ($this->filtersCategories->removeElement($filtersCategory)) {
  576.             $filtersCategory->removeChannel($this);
  577.         }
  578.         return $this;
  579.     }
  580.     public function getTvUser(): ?TvUser
  581.     {
  582.         return $this->tvUser;
  583.     }
  584.     public function setTvUser(?TvUser $tvUser): self
  585.     {
  586.         $this->tvUser $tvUser;
  587.         return $this;
  588.     }
  589.     public function getRank(): ?int
  590.     {
  591.         return $this->rank;
  592.     }
  593.     public function setRank(?int $rank): self
  594.     {
  595.         $this->rank $rank;
  596.         return $this;
  597.     }
  598.     public function getCreatedAt(): ?\DateTimeInterface
  599.     {
  600.         return $this->createdAt;
  601.     }
  602.     public function setCreatedAt(\DateTimeInterface $createdAt): self
  603.     {
  604.         $this->createdAt $createdAt;
  605.         return $this;
  606.     }
  607.     public function getUpdatedAt(): ?\DateTimeInterface
  608.     {
  609.         return $this->updatedAt;
  610.     }
  611.     public function setUpdatedAt(\DateTimeInterface $updatedAt): self
  612.     {
  613.         $this->updatedAt $updatedAt;
  614.         return $this;
  615.     }
  616.     public function getThematicMotivationEndPhrase(): ?string
  617.     {
  618.         return $this->thematicMotivationEndPhrase;
  619.     }
  620.     public function setThematicMotivationEndPhrase(?string $thematicMotivationEndPhrase): self
  621.     {
  622.         $this->thematicMotivationEndPhrase $thematicMotivationEndPhrase;
  623.         return $this;
  624.     }
  625.     public function getType(): ?string
  626.     {
  627.         return $this->type;
  628.     }
  629.     public function setType(?string $type): self
  630.     {
  631.         $this->type $type;
  632.         return $this;
  633.     }
  634.     /**
  635.      * @param int $videosCount
  636.      * @return Channel
  637.      */
  638.     public function setVideosCount(int $videosCount): Channel
  639.     {
  640.         $this->videosCount $videosCount;
  641.         return $this;
  642.     }
  643.     /**
  644.      * @return Collection|TvTag[]
  645.      */
  646.     public function getTvTags(): Collection
  647.     {
  648.         return $this->tvTags;
  649.     }
  650.     /**
  651.      * @return Channel
  652.      * @Groups({"channel:write"})
  653.      */
  654.     public function setTvTags(Collection $tvTags): self
  655.     {
  656.         $this->tvTags $tvTags;
  657.         foreach ($this->tvTags as $tvTag) {
  658.             $this->stringifyTags .= "#".$tvTag->getName();
  659.         }
  660.         return $this;
  661.     }
  662.     public function addTvTag(TvTag $tvTag): self
  663.     {
  664.         if (!$this->tvTags->contains($tvTag)) {
  665.             $this->tvTags[] = $tvTag;
  666.         }
  667.         return $this;
  668.     }
  669.     public function removeTvTag(TvTag $tvTag): self
  670.     {
  671.         $this->tvTags->removeElement($tvTag);
  672.         return $this;
  673.     }
  674.     public function getStringifyTags(): ?string
  675.     {
  676.         return $this->stringifyTags;
  677.     }
  678.     public function setStringifyTags(?string $stringifyTags): self
  679.     {
  680.         $this->stringifyTags $stringifyTags;
  681.         return $this;
  682.     }
  683.     /**
  684.      * @param bool $excluded
  685.      * @return Channel
  686.      */
  687.     public function setExcluded(bool $excluded): Channel
  688.     {
  689.         $this->excluded $excluded;
  690.         return $this;
  691.     }
  692.     /**
  693.      * @return bool
  694.      */
  695.     public function isExcluded(): bool
  696.     {
  697.         return $this->excluded;
  698.     }
  699.     /**
  700.      * @return Collection|Video[]
  701.      */
  702.     public function getDefaultVideos(): Collection
  703.     {
  704.         return $this->defaultVideos;
  705.     }
  706.     public function addDefaultVideo(Video $defaultVideo): self
  707.     {
  708.         if (!$this->defaultVideos->contains($defaultVideo)) {
  709.             $this->defaultVideos[] = $defaultVideo;
  710.             $defaultVideo->setDefaultChannel($this);
  711.         }
  712.         return $this;
  713.     }
  714.     public function removeDefaultVideo(Video $defaultVideo): self
  715.     {
  716.         if ($this->defaultVideos->removeElement($defaultVideo)) {
  717.             // set the owning side to null (unless already changed)
  718.             if ($defaultVideo->getDefaultChannel() === $this) {
  719.                 $defaultVideo->setDefaultChannel(null);
  720.             }
  721.         }
  722.         return $this;
  723.     }
  724.     /**
  725.      * @return Collection|Objective[]
  726.      */
  727.     public function getObjectives(): Collection
  728.     {
  729.         return $this->objectives;
  730.     }
  731.     /**
  732.      * @return Collection|Objective[]
  733.      */
  734.     public function setObjectives(Collection $objectives): self
  735.     {
  736.         $this->objectives $objectives;
  737.         return $this;
  738.     }
  739.     public function addObjective(Objective $objective): self
  740.     {
  741.         if (!$this->objectives->contains($objective)) {
  742.             $this->objectives[] = $objective;
  743.             $objective->addChannel($this);
  744.         }
  745.         return $this;
  746.     }
  747.     
  748.     public function removeObjective(Objective $objective): self
  749.     {
  750.         if ($this->objectives->removeElement($objective)) {
  751.             $objective->removeChannel($this);
  752.         }
  753.         return $this;
  754.     }
  755.     public function getItCanInterrest(): ?bool
  756.     {
  757.         return $this->itCanInterrest;
  758.     }
  759.     public function setItCanInterrest(bool $itCanInterrest): self
  760.     {
  761.         $this->itCanInterrest $itCanInterrest;
  762.         return $this;
  763.     }
  764.     /**
  765.      * @return Collection|ProgramEvent[]
  766.      */
  767.     public function getProgramEvents(): Collection
  768.     {
  769.         return $this->programEvents;
  770.     }
  771.     public function addProgramEvent(ProgramEvent $programEvent): self
  772.     {
  773.         if (!$this->programEvents->contains($programEvent)) {
  774.             $this->programEvents[] = $programEvent;
  775.             $programEvent->setChannel($this);
  776.         }
  777.         return $this;
  778.     }
  779.     public function removeProgramEvent(ProgramEvent $programEvent): self
  780.     {
  781.         if ($this->programEvents->removeElement($programEvent)) {
  782.             // set the owning side to null (unless already changed)
  783.             if ($programEvent->getChannel() === $this) {
  784.                 $programEvent->setChannel(null);
  785.             }
  786.         }
  787.         return $this;
  788.     }
  789. }