src/Entity/VideoGallery.php line 95

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Annotation\EsUploadable;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use App\Entity\Model\BulletPoint;
  6. use App\Annotation\EsElasticIndex;
  7. use App\Filter\SearchWithTagFilter;
  8. use ApiPlatform\Core\Annotation\ApiFilter;
  9. use App\Entity\Traits\TimestampableEntity;
  10. use App\Repository\VideoGalleryRepository;
  11. use Doctrine\Common\Collections\Collection;
  12. use ApiPlatform\Core\Annotation\ApiResource;
  13. use App\Entity\Interfaces\UploadMappedInterface;
  14. use Doctrine\Common\Collections\ArrayCollection;
  15. use App\Entity\Interfaces\ElasticMappedInterface;
  16. use App\Entity\Interfaces\ContainerMappedInterface;
  17. use App\Entity\Interfaces\NewsfeedCreatorInterface;
  18. use Symfony\Component\Serializer\Annotation\Groups;
  19. use Symfony\Component\Validator\Constraints as Assert;
  20. use Symfony\Component\Serializer\Annotation\SerializedName;
  21. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\OrderFilter;
  22. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter;
  23. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\BooleanFilter;
  24. use Locastic\ApiPlatformTranslationBundle\Model\AbstractTranslatable;
  25. use Locastic\ApiPlatformTranslationBundle\Model\TranslationInterface;
  26. /**
  27.  * @ApiResource(
  28.  *      attributes={"security"="is_granted('ROLE_OPERATOR')", "filters"={"translation.groups"}},
  29.  *      normalizationContext={"groups"={"VideoGallery:Read", "TZ:Read"}, "skip_null_values"=false},
  30.  *      denormalizationContext={"groups"={"VideoGallery:Write", "VideoGalleryTranslationsGroup"}},
  31.  *      collectionOperations={
  32.  *          "get",
  33.  *          "get_public"={
  34.  *              "path"="/video-galleries/get-public",
  35.  *              "method"="GET",
  36.  *              "normalization_context"={"groups"={"VideoGallery:Read-Public", "TZ:Read"}, "skip_null_values"=false},
  37.  *              "security"="is_granted('IS_AUTHENTICATED_FULLY')",
  38.  *              "pagination_enabled"=false
  39.  *          },
  40.  *          "get_for_public_page"={
  41.  *              "route_name"="api_pub_video_galleries_get_for_public_page_collection",
  42.  *              "method"="GET",
  43.  *              "security"="is_granted('PUBLIC_ACCESS')",
  44.  *              "normalization_context"={"groups"={"VideoGallery:PRead"}, "skip_null_values"=false},
  45.  *              "pagination_enabled"=true
  46.  *          },
  47.  *          "get_top"={
  48.  *              "path"="/video-galleries/get-top",
  49.  *              "method"="GET",
  50.  *              "normalization_context"={"groups"={"VideoGallery:Read-Public", "TZ:Read"}, "skip_null_values"=false},
  51.  *              "security"="is_granted('IS_AUTHENTICATED_FULLY')"
  52.  *          },
  53.  *          "get_my_history"={
  54.  *              "path"="/video-galleries/get-my-history",
  55.  *              "method"="GET",
  56.  *              "normalization_context"={"groups"={"VideoGallery:Read-Public", "TZ:Read"}, "skip_null_values"=false},
  57.  *              "security"="is_granted('IS_AUTHENTICATED_FULLY')"
  58.  *          },
  59.  *          "get_my_favorite"={
  60.  *              "path"="/video-galleries/get-my-favorite",
  61.  *              "method"="GET",
  62.  *              "normalization_context"={"groups"={"VideoGallery:Read-Public", "TZ:Read"}, "skip_null_values"=false},
  63.  *              "security"="is_granted('IS_AUTHENTICATED_FULLY')"
  64.  *          },
  65.  *          "post",
  66.  *          "post_source"={
  67.  *              "path"="/video-galleries/from-source",
  68.  *              "method"="POST",
  69.  *              "denormalization_context"={"groups"={"VideoGallery:From-Source"}}
  70.  *          }
  71.  *      },
  72.  *      itemOperations={
  73.  *          "get"={"security"="is_granted('IS_CO_OPR', object)"},
  74.  *          "get_show"={
  75.  *              "path"="/video-galleries/{id}/get-show",
  76.  *              "method"="GET",
  77.  *              "normalization_context"={"groups"={"VideoGallery:Read-Public", "TZ:Read"}, "skip_null_values"=false},
  78.  *              "security"="is_granted('IS_AUTHENTICATED_FULLY')"
  79.  *          },
  80.  *          "put"={"security"="is_granted('IS_CO_OPR', object)"},
  81.  *          "patch"={"security"="is_granted('IS_CO_OPR', object)"},
  82.  *          "delete"={"security"="is_granted('IS_CO_OPR', object)"}
  83.  *     }
  84.  * )
  85.  * @ApiFilter(SearchFilter::class, properties={"id": "exact", "container.id": "exact", "videoGalleryCategory.id": "exact", "translations.title": "partial", "videoGalleryTags.id": "exact", "type": "exact", "typeId": "exact", "videoGalleryTags.id", "exact", "videoGalleryHistories.user.id", "exact", "videoGalleryFavorites.user.id", "exact", "speakers.id", "exact", "moderators.id", "exact"})
  86.  * @ApiFilter(SearchWithTagFilter::class, properties={"search_with_tag": "partial"})
  87.  * @ApiFilter(BooleanFilter::class, properties={"isActive"})
  88.  * @ApiFilter(OrderFilter::class, properties={"id": "DESC", "translations.title", "videoGalleryCategory.ord"})
  89.  * @ORM\Entity(repositoryClass=VideoGalleryRepository::class)
  90.  * @EsElasticIndex("VideoGallery:EL")
  91.  */
  92. class VideoGallery extends AbstractTranslatable implements ContainerMappedInterfaceUploadMappedInterfaceNewsfeedCreatorInterfaceElasticMappedInterface
  93. {
  94.     /**
  95.      * Hook timestampable behavior
  96.      * updates createdAt, updatedAt fields
  97.      */
  98.     use TimestampableEntity;
  99.     /**
  100.      * @ORM\OneToMany(targetEntity="VideoGalleryTranslation", mappedBy="translatable", fetch="EXTRA_LAZY", indexBy="locale", cascade={"PERSIST"}, orphanRemoval=true)
  101.      *
  102.      * @Groups({"VideoGallery:EL", "VideoGallery:Write", "VideoGalleryTranslationsGroup", "VideoGallery:PRead"})
  103.      * @Assert\Valid()
  104.      */
  105.     protected $translations;
  106.     /**
  107.      * @Groups({"VideoGallery:Read", "VideoGallery:PRead", "VideoGallery:Read-Public", "VideoGalleryHistory:Read", "Session:GetItem", "ElTask:Detail", "ElLession:Detail"})
  108.      */
  109.     private $title;
  110.     /**
  111.      * @Groups({"VideoGallery:Read", "VideoGallery:PRead", "VideoGallery:Read-Public"})
  112.      */
  113.     private $description;
  114.     /**
  115.      * @Groups({"VideoGallery:Read", "VideoGallery:PRead", "VideoGallery:Read-Public"})
  116.      */
  117.     private $streamUrl;
  118.     /**
  119.      * @ORM\Id
  120.      * @ORM\GeneratedValue
  121.      * @ORM\Column(type="integer")
  122.      * @Groups({"VideoGallery:EL", "VideoGallery:Read", "VideoGallery:PRead", "VideoGallery:Read-Public", "VideoGalleryHistory:Read", "Session:GetItem", "ElTask:Detail", "ElLession:Detail"})
  123.      */
  124.     private $id;
  125.     /**
  126.      * @ORM\Column(type="string", length=32)
  127.      * @Groups({"VideoGallery:Read", "VideoGallery:Read-Public", "VideoGallery:Write", "VideoGallery:From-Source"})
  128.      * @Assert\NotBlank(message="validation.videoGallery:end.notBlank")
  129.      */
  130.     private $type;
  131.     public const VIDEOGALLERYTYPE_UPLOAD "UPLOAD";
  132.     public const VIDEOGALLERYTYPE_SESSION "SESSION";
  133.     public const VIDEOGALLERYTYPE_TASK "TASK";
  134.     /**
  135.      * @ORM\Column(type="integer", nullable=true)
  136.      * @Groups({"VideoGallery:Read", "VideoGallery:Read-Public", "VideoGallery:Write", "VideoGallery:From-Source"})
  137.      */
  138.     private $typeId;
  139.     /**
  140.      * @ORM\Column(type="string", length=255, nullable=true)
  141.      * @Groups({"VideoGallery:EL", "VideoGallery:Read", "VideoGallery:PRead", "VideoGallery:Read-Public", "VideoGallery:Write"})
  142.      * @Assert\Length(max=255, maxMessage="validation.videoGallery:imageName.max")
  143.      * @EsUploadable()
  144.      */
  145.     protected $videoFileName;
  146.     /**
  147.      * @ORM\Column(type="json", nullable=true)
  148.      * @Groups({"VideoGallery:Read", "VideoGallery:PRead", "VideoGallery:Read-Public", "VideoGallery:Write"})
  149.      */
  150.     private $metadata = [];
  151.     /**
  152.      * @ORM\Column(type="boolean", nullable=true)
  153.      * @Groups({"VideoGallery:Read", "VideoGallery:Read-Public", "VideoGallery:Write", "VideoGallery:From-Source"})
  154.      */
  155.     private $isActive;
  156.     /**
  157.      * @ORM\ManyToOne(targetEntity=CommonCategory::class)
  158.      * @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
  159.      * @Groups({"VideoGallery:Read", "VideoGallery:PRead", "VideoGallery:Read-Public", "VideoGallery:Write", "VideoGallery:From-Source", "Session:GetItem", "ElTask:Detail", "ElLession:Detail"})
  160.      */
  161.     private $videoGalleryCategory;
  162.     /**
  163.      * @ORM\ManyToMany(targetEntity=UserGroup::class)
  164.      * @Groups({"VideoGallery:Read", "VideoGallery:Write"})
  165.      */
  166.     private $userGroups;
  167.     /**
  168.      * @ORM\ManyToMany(targetEntity=User::class)
  169.      * @ORM\JoinTable(name="rel_video_gallery_speaker")
  170.      * @ORM\OrderBy({"lastName" = "ASC"})
  171.      * @Groups({"VideoGallery:EL", "VideoGallery:Read", "VideoGallery:PRead", "VideoGallery:Read-Public", "VideoGallery:Write"})
  172.      */
  173.     private $speakers;
  174.     /**
  175.      * @ORM\ManyToMany(targetEntity=User::class)
  176.      * @ORM\JoinTable(name="rel_video_gallery_moderators")
  177.      * @ORM\OrderBy({"lastName" = "ASC"})
  178.      * @Groups({"VideoGallery:EL", "VideoGallery:Read", "VideoGallery:PRead", "VideoGallery:Read-Public", "VideoGallery:Write"})
  179.      */
  180.     private $moderators;
  181.     /**
  182.      * @ORM\ManyToOne(targetEntity=Container::class)
  183.      * @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
  184.      * @Groups({"VideoGallery:Write", "VideoGallery:PRead"})
  185.      */
  186.     private $container;
  187.     /**
  188.      * @ORM\ManyToMany(targetEntity=VideoGalleryTag::class, inversedBy="videoGalleries", cascade={"persist"})
  189.      * @Groups({"VideoGallery:Read", "VideoGallery:PRead", "VideoGallery:Read-Public", "VideoGallery:Write"})
  190.      */
  191.     private $videoGalleryTags;
  192.     /**
  193.      * @ORM\OneToMany(targetEntity=VideoGalleryHistory::class, mappedBy="videoGallery")
  194.      */
  195.     private $videoGalleryHistories;
  196.     /**
  197.      * @ORM\OneToMany(targetEntity=VideoGalleryFavorite::class, mappedBy="videoGallery")
  198.      */
  199.     private $videoGalleryFavorites;
  200.     /**
  201.      * @ORM\Column(type="string", length=255, nullable=true)
  202.      * @Groups({"VideoGallery:EL", "VideoGallery:Read", "VideoGallery:PRead", "VideoGallery:Read-Public", "VideoGallery:Write"})
  203.      * @EsUploadable()
  204.      */
  205.     protected $imageName;
  206.     /**
  207.      * @ORM\Column(type="string", length=32, nullable=true)
  208.      * @Groups({"VideoGallery:EL", "VideoGallery:Read", "VideoGallery:PRead", "VideoGallery:Read-Public", "VideoGallery:Write"})
  209.      */
  210.     private $streamType;
  211.     public const STREAMTYPE_YOUTUBE "YOUTUBE";
  212.     public const STREAMTYPE_VIMEO "VIMEO";
  213.     public const STREAMTYPE_SWISSCOM "SWISSCOM";
  214.     public const STREAMTYPE_DACAST "DACAST";
  215.     public const STREAMTYPE_KNOVIO "KNOVIO";
  216.     public const STREAMTYPE_ZOOM "ZOOM";
  217.     public const STREAMTYPE_WEBEX "WEBEX";
  218.     public const STREAMTYPE_FILE "FILE";
  219.     public const STREAMTYPE_EXPERTSHARE "EXPERTSHARE";
  220.     public const STREAMTYPE_QUMU "QUMU";
  221.     /**
  222.      * @ORM\Column(type="integer", nullable=true)
  223.      * @Groups({"VideoGallery:EL", "VideoGallery:Read", "VideoGallery:PRead", "VideoGallery:Read-Public"})
  224.      */
  225.     private $totalViews;
  226.     /**
  227.      * @ORM\Column(type="boolean", nullable=true)
  228.      * @Groups({"VideoGallery:EL", "VideoGallery:Read", "VideoGallery:PRead", "VideoGallery:Read-Public"})
  229.      */
  230.     private $isTop;
  231.     /**
  232.      * @ORM\Column(type="boolean", nullable=true)
  233.      * @Groups({"VideoGallery:Read", "VideoGallery:Read-Public", "VideoGallery:Write"})
  234.      */
  235.     private $isShowPublic;
  236.     /**
  237.      * @ORM\OneToMany(targetEntity=CommonComment::class, mappedBy="videoGallery")
  238.      */
  239.     private $commonComments;
  240.     /**
  241.      * @ORM\OneToMany(targetEntity=VideoGalleryChapter::class, mappedBy="videoGallery", orphanRemoval=true)
  242.      * @Groups({"VideoGallery:Read-Public"})
  243.      */
  244.     private $videoGalleryChapters;
  245.     /**
  246.      * @ORM\OneToMany(targetEntity=VideoGalleryDoc::class, mappedBy="videoGallery", orphanRemoval=true, cascade={"persist"})
  247.      *
  248.      * @Groups({"VideoGallery:Read", "VideoGallery:Write", "VideoGallery:Read-Public"})
  249.      */
  250.     private $videoGalleryDocs;
  251.     /**
  252.      * @ORM\Column(type="array", nullable=true)
  253.      *
  254.      * @Groups({"VideoGallery:EL", "VideoGallery:Read", "VideoGallery:Write", "VideoGallery:Read-Public"})
  255.      */
  256.     private $bulletPoints = [];
  257.     /**
  258.      * @ORM\Column(type="boolean", nullable=true)
  259.      *
  260.      * @Groups({"VideoGallery:Read", "VideoGallery:Write", "VideoGallery:Read-Public"})
  261.      */
  262.     private $isCommentEnable true;
  263.     /**
  264.      * @ORM\Column(type="boolean", nullable=true)
  265.      * @Groups({"VideoGallery:EL", "VideoGallery:Read", "VideoGallery:Write", "VideoGallery:Read-Public"})
  266.      */
  267.     private $isDownload;
  268.     public function __construct()
  269.     {
  270.         parent::__construct();
  271.         $this->userGroups = new ArrayCollection();
  272.         $this->speakers = new ArrayCollection();
  273.         $this->moderators = new ArrayCollection();
  274.         $this->videoGalleryTags = new ArrayCollection();
  275.         $this->commonComments = new ArrayCollection();
  276.         $this->videoGalleryChapters = new ArrayCollection();
  277.         $this->videoGalleryDocs = new ArrayCollection();
  278.         $bulletPointModel = new BulletPoint();
  279.         $this->bulletPoints $bulletPointModel->getProperties();
  280.     }
  281.     protected function createTranslation(): TranslationInterface
  282.     {
  283.         return new VideoGalleryTranslation();
  284.     }
  285.     public function addTranslation(TranslationInterface $translation): void
  286.     {
  287.         $this->setUpdatedAt(new \DateTime());
  288.         parent::addTranslation($translation);
  289.     }
  290.     public function getTitle(): ?string
  291.     {
  292.         return $this->getTranslation()->getTitle();
  293.     }
  294.     public function setTitle(string $title): self
  295.     {
  296.         $this->getTranslation()->setTitle($title);
  297.         return $this;
  298.     }
  299.     public function getDescription(): ?string
  300.     {
  301.         return $this->getTranslation()->getDescription();
  302.     }
  303.     public function setDescription(string $description): self
  304.     {
  305.         $this->getTranslation()->setDescription($description);
  306.         return $this;
  307.     }
  308.     public function getStreamUrl(): ?string
  309.     {
  310.         return $this->getTranslation()->getStreamUrl();
  311.     }
  312.     public function setStreamUrl(string $streamUrl): self
  313.     {
  314.         $this->getTranslation()->setStreamUrl($streamUrl);
  315.         return $this;
  316.     }
  317.     public function getId(): ?int
  318.     {
  319.         return $this->id;
  320.     }
  321.     public function getType(): ?string
  322.     {
  323.         return $this->type;
  324.     }
  325.     public function setType(string $type): self
  326.     {
  327.         $this->type $type;
  328.         return $this;
  329.     }
  330.     public function getVideoFileName(): ?string
  331.     {
  332.         return $this->videoFileName;
  333.     }
  334.     public function setVideoFileName(?string $videoFileName): self
  335.     {
  336.         $this->videoFileName $videoFileName;
  337.         return $this;
  338.     }
  339.     public function getMetadata(): ?array
  340.     {
  341.         return $this->metadata;
  342.     }
  343.     public function setMetadata(?array $metadata): self
  344.     {
  345.         $this->metadata $metadata;
  346.         return $this;
  347.     }
  348.     public function getTypeId(): ?int
  349.     {
  350.         return $this->typeId;
  351.     }
  352.     public function setTypeId(?int $typeId): self
  353.     {
  354.         $this->typeId $typeId;
  355.         return $this;
  356.     }
  357.     public function getIsActive(): ?bool
  358.     {
  359.         return $this->isActive;
  360.     }
  361.     public function setIsActive(?bool $isActive): self
  362.     {
  363.         $this->isActive $isActive;
  364.         return $this;
  365.     }
  366.     public function getVideoGalleryCategory(): ?CommonCategory
  367.     {
  368.         return $this->videoGalleryCategory;
  369.     }
  370.     public function setVideoGalleryCategory(?CommonCategory $videoGalleryCategory): self
  371.     {
  372.         $this->videoGalleryCategory $videoGalleryCategory;
  373.         return $this;
  374.     }
  375.     /**
  376.      * @return Collection|UserGroup[]
  377.      */
  378.     public function getUserGroups(): Collection
  379.     {
  380.         return $this->userGroups;
  381.     }
  382.     /**
  383.      * @Groups({"VideoGallery:EL"})
  384.      * @SerializedName("groups")
  385.      */
  386.     public function getUserGroupsArray()
  387.     {
  388.         $groups = [];
  389.         foreach ($this->userGroups as $group) {
  390.             if (!$group->getIsGenerated()) {
  391.                 $groups[] = $group->getId();
  392.             }
  393.         }
  394.         return $groups;
  395.     }
  396.     public function addUserGroup(UserGroup $userGroup): self
  397.     {
  398.         if (!$this->userGroups->contains($userGroup)) {
  399.             $this->userGroups[] = $userGroup;
  400.         }
  401.         return $this;
  402.     }
  403.     public function removeUserGroup(UserGroup $userGroup): self
  404.     {
  405.         $this->userGroups->removeElement($userGroup);
  406.         return $this;
  407.     }
  408.     public function removeAllUserGroups(): self
  409.     {
  410.         foreach ($this->userGroups as $userGroup) {
  411.             $this->removeUserGroup($userGroup);
  412.         }
  413.         return $this;
  414.     }
  415.     /**
  416.      * @return Collection|User[]
  417.      */
  418.     public function getSpeakers(): Collection
  419.     {
  420.         return $this->speakers;
  421.     }
  422.     public function addSpeaker(User $speaker): self
  423.     {
  424.         if (!$this->speakers->contains($speaker)) {
  425.             $this->speakers[] = $speaker;
  426.         }
  427.         return $this;
  428.     }
  429.     public function removeSpeaker(User $speaker): self
  430.     {
  431.         $this->speakers->removeElement($speaker);
  432.         return $this;
  433.     }
  434.     public function removeAllSpeakers(): self
  435.     {
  436.         $speakers $this->getSpeakers();
  437.         foreach ($speakers as $speaker) {
  438.             $this->removeSpeaker($speaker);
  439.         }
  440.         return $this;
  441.     }
  442.     /**
  443.      * @return Collection|User[]
  444.      */
  445.     public function getModerators(): Collection
  446.     {
  447.         return $this->moderators;
  448.     }
  449.     public function addModerator(User $moderator): self
  450.     {
  451.         if (!$this->moderators->contains($moderator)) {
  452.             $this->moderators[] = $moderator;
  453.         }
  454.         return $this;
  455.     }
  456.     public function removeModerator(User $moderator): self
  457.     {
  458.         $this->moderators->removeElement($moderator);
  459.         return $this;
  460.     }
  461.     public function removeAllModerators(): self
  462.     {
  463.         foreach ($this->moderators as $moderator) {
  464.             $this->removeModerator($moderator);
  465.         }
  466.         return $this;
  467.     }
  468.     public function getContainer(): ?Container
  469.     {
  470.         return $this->container;
  471.     }
  472.     public function setContainer(?Container $container): self
  473.     {
  474.         $this->container $container;
  475.         return $this;
  476.     }
  477.     /**
  478.      * @return Collection|VideoGalleryTag[]
  479.      */
  480.     public function getVideoGalleryTags(): Collection
  481.     {
  482.         return $this->videoGalleryTags;
  483.     }
  484.     /**
  485.      * @Groups({"VideoGallery:EL"})
  486.      * @SerializedName("tags")
  487.      */
  488.     public function getTagsArray()
  489.     {
  490.         $tags = [];
  491.         foreach ($this->videoGalleryTags as $tag) {
  492.             $tags[] = $tag->getName();
  493.         }
  494.         return $tags;
  495.     }
  496.     public function addVideoGalleryTag(VideoGalleryTag $videoGalleryTag): self
  497.     {
  498.         if (!$this->videoGalleryTags->contains($videoGalleryTag)) {
  499.             $this->videoGalleryTags[] = $videoGalleryTag;
  500.         }
  501.         return $this;
  502.     }
  503.     public function removeVideoGalleryTag(VideoGalleryTag $videoGalleryTag): self
  504.     {
  505.         $this->videoGalleryTags->removeElement($videoGalleryTag);
  506.         return $this;
  507.     }
  508.     public function reAttachTags(): self
  509.     {
  510.         $tags $this->videoGalleryTags;
  511.         foreach ($tags as $tag) {
  512.             $nt = clone $tag;
  513.             $nt->setContainer($this->getContainer());
  514.             $this->removeVideoGalleryTag($tag);
  515.             $this->addVideoGalleryTag($nt);
  516.         }
  517.         return $this;
  518.     }
  519.     /**
  520.      * @return Collection|VideoGalleryHistory[]
  521.      */
  522.     public function getVideoGalleryHistories(): Collection
  523.     {
  524.         return $this->videoGalleyHistories;
  525.     }
  526.     public function addVideoGalleryHistory(VideoGalleryHistory $videoGalleryHistory): self
  527.     {
  528.         if (!$this->videoGalleyHistories->contains($videoGalleryHistory)) {
  529.             $this->videoGalleyHistories[] = $videoGalleryHistory;
  530.             $videoGalleryHistory->setVideoGallery($this);
  531.         }
  532.         return $this;
  533.     }
  534.     public function removeVideoGalleryHistory(VideoGalleryHistory $videoGalleryHistory): self
  535.     {
  536.         if ($this->videoGalleyHistories->removeElement($videoGalleryHistory)) {
  537.             // set the owning side to null (unless already changed)
  538.             if ($videoGalleryHistory->getVideoGallery() === $this) {
  539.                 $videoGalleryHistory->setVideoGallery(null);
  540.             }
  541.         }
  542.         return $this;
  543.     }
  544.     /**
  545.      * @return Collection|VideoGalleryFavorite[]
  546.      */
  547.     public function getVideoGalleryFavorites(): Collection
  548.     {
  549.         return $this->videoGalleryFavorites;
  550.     }
  551.     public function addVideoGalleryFavorite(VideoGalleryFavorite $videoGalleryFavorite): self
  552.     {
  553.         if (!$this->videoGalleryFavorites->contains($videoGalleryFavorite)) {
  554.             $this->videoGalleryFavorites[] = $videoGalleryFavorite;
  555.             $videoGalleryFavorite->setVideoGallery($this);
  556.         }
  557.         return $this;
  558.     }
  559.     public function removeVideoGalleryFavorite(VideoGalleryFavorite $videoGalleryFavorite): self
  560.     {
  561.         if ($this->videoGalleryFavorites->removeElement($videoGalleryFavorite)) {
  562.             // set the owning side to null (unless already changed)
  563.             if ($videoGalleryFavorite->getVideoGallery() === $this) {
  564.                 $videoGalleryFavorite->setVideoGallery(null);
  565.             }
  566.         }
  567.         return $this;
  568.     }
  569.     public function getImageName(): ?string
  570.     {
  571.         return $this->imageName;
  572.     }
  573.     public function setImageName(?string $imageName): self
  574.     {
  575.         $this->imageName $imageName;
  576.         return $this;
  577.     }
  578.     public function getStreamType(): ?string
  579.     {
  580.         return $this->streamType;
  581.     }
  582.     public function setStreamType(?string $streamType): self
  583.     {
  584.         $this->streamType $streamType;
  585.         return $this;
  586.     }
  587.     public function getTotalViews(): ?int
  588.     {
  589.         return $this->totalViews;
  590.     }
  591.     public function setTotalViews(?int $totalViews): self
  592.     {
  593.         $this->totalViews $totalViews;
  594.         return $this;
  595.     }
  596.     public function getIsTop(): ?bool
  597.     {
  598.         return $this->isTop;
  599.     }
  600.     public function setIsTop(?bool $isTop): self
  601.     {
  602.         $this->isTop $isTop;
  603.         return $this;
  604.     }
  605.     public function getIsShowPublic(): ?bool
  606.     {
  607.         return $this->isShowPublic;
  608.     }
  609.     public function setIsShowPublic(?bool $isShowPublic): self
  610.     {
  611.         $this->isShowPublic $isShowPublic;
  612.         return $this;
  613.     }
  614.     public function getIsPostEnable()
  615.     {
  616.         return true;
  617.     }
  618.     public function getPostPoster()
  619.     {
  620.         return $this->getImageName();
  621.     }
  622.     public function getMetadataTranslation()
  623.     {
  624.         $translations = [];
  625.         foreach ($this->getTranslations() as $translation) {
  626.             $translations[] = [
  627.                 $translation->getLocale() => [
  628.                     'title' => $translation->getTitle(),
  629.                     'description' => $translation->getDescription(),
  630.                     'streamUrl' => $translation->getStreamUrl()
  631.                 ]
  632.             ];
  633.         }
  634.         return $translations;
  635.     }
  636.     public function getPostMetadata()
  637.     {
  638.         $speakers = [];
  639.         foreach ($this->getSpeakers() as $a) {
  640.             $speakers[] = $a->getMetadata();
  641.         }
  642.         return [
  643.             'videoGallery' => [
  644.                 'id' => $this->getId(),
  645.                 'translations' => $this->getMetadataTranslation(),
  646.                 'type' => $this->getType(),
  647.                 'typeId' => $this->getTypeId(),
  648.                 'videoFileName' => $this->getVideoFileName(),
  649.                 'metadata' => $this->getMetadata(),
  650.                 'tags' => $this->getTagsArray(),
  651.                 'videoGalleryCategory' => $this->getVideoGalleryCategory() ? $this->getVideoGalleryCategory()->getMeta() : null,
  652.                 'speakers' => $speakers
  653.             ]
  654.         ];
  655.     }
  656.     public function getPostUserGroups()
  657.     {
  658.         return $this->getUserGroups();
  659.     }
  660.     public function getPostSubSource()
  661.     {
  662.         return Newsfeed::POSTSUBTYPE_VIDEOGALLERY;
  663.     }
  664.     public function getPostText()
  665.     {
  666.         $postText = [];
  667.         foreach ($this->getTranslations() as $translation) {
  668.             $postText[] = $translation->getTitle();
  669.         }
  670.         return implode('###'$postText);
  671.     }
  672.     public function getPostSource()
  673.     {
  674.         return CommonComment::SOURCE_VIDEOGALLERY;
  675.     }
  676.     /**
  677.      * @return Collection<int, CommonComment>
  678.      */
  679.     public function getCommonComments(): Collection
  680.     {
  681.         return $this->commonComments;
  682.     }
  683.     public function addCommonComment(CommonComment $commonComment): self
  684.     {
  685.         if (!$this->commonComments->contains($commonComment)) {
  686.             $this->commonComments[] = $commonComment;
  687.             $commonComment->setVideoGallery($this);
  688.         }
  689.         return $this;
  690.     }
  691.     public function removeCommonComment(CommonComment $commonComment): self
  692.     {
  693.         if ($this->commonComments->removeElement($commonComment)) {
  694.             // set the owning side to null (unless already changed)
  695.             if ($commonComment->getVideoGallery() === $this) {
  696.                 $commonComment->setVideoGallery(null);
  697.             }
  698.         }
  699.         return $this;
  700.     }
  701.     /**
  702.      * @return Collection<int, VideoGalleryChapter>
  703.      */
  704.     public function getVideoGalleryChapters(): Collection
  705.     {
  706.         return $this->videoGalleryChapters;
  707.     }
  708.     public function addVideoGalleryChapter(VideoGalleryChapter $videoGalleryChapter): self
  709.     {
  710.         if (!$this->videoGalleryChapters->contains($videoGalleryChapter)) {
  711.             $this->videoGalleryChapters[] = $videoGalleryChapter;
  712.             $videoGalleryChapter->setVideoGallery($this);
  713.         }
  714.         return $this;
  715.     }
  716.     public function removeVideoGalleryChapter(VideoGalleryChapter $videoGalleryChapter): self
  717.     {
  718.         if ($this->videoGalleryChapters->removeElement($videoGalleryChapter)) {
  719.             // set the owning side to null (unless already changed)
  720.             if ($videoGalleryChapter->getVideoGallery() === $this) {
  721.                 $videoGalleryChapter->setVideoGallery(null);
  722.             }
  723.         }
  724.         return $this;
  725.     }
  726.     /**
  727.      * @return Collection|VideoGalleryDoc[]
  728.      */
  729.     public function getVideoGalleryDocs(): Collection
  730.     {
  731.         return $this->videoGalleryDocs;
  732.     }
  733.     public function addVideoGalleryDoc(VideoGalleryDoc $videoGalleryDoc): self
  734.     {
  735.         if (!$this->videoGalleryDocs->contains($videoGalleryDoc)) {
  736.             $this->videoGalleryDocs[] = $videoGalleryDoc;
  737.             $videoGalleryDoc->setVideoGallery($this);
  738.         }
  739.         return $this;
  740.     }
  741.     public function removeVideoGalleryDoc(VideoGalleryDoc $videoGalleryDoc): self
  742.     {
  743.         if ($this->videoGalleryDocs->removeElement($videoGalleryDoc)) {
  744.             // set the owning side to null (unless already changed)
  745.             if ($videoGalleryDoc->getVideoGallery() === $this) {
  746.                 $videoGalleryDoc->setVideoGallery(null);
  747.             }
  748.         }
  749.         return $this;
  750.     }
  751.     public function getBulletPoints(): ?array
  752.     {
  753.         if ($this->bulletPoints === null) {
  754.             $this->bulletPoints = [];
  755.         }
  756.         return $this->bulletPoints;
  757.     }
  758.     public function setBulletPoints(?array $bulletPoints): self
  759.     {
  760.         if (!is_array($bulletPoints)) {
  761.             return $this;
  762.         }
  763.         $this->bulletPoints $bulletPoints;
  764.         return $this;
  765.     }
  766.     public function getIsCommentEnable(): ?bool
  767.     {
  768.         return $this->isCommentEnable;
  769.     }
  770.     public function setIsCommentEnable(?bool $isCommentEnable): self
  771.     {
  772.         $this->isCommentEnable $isCommentEnable;
  773.         return $this;
  774.     }
  775.     public function isIsDownload(): ?bool
  776.     {
  777.         return $this->isDownload;
  778.     }
  779.     public function setIsDownload(?bool $isDownload): self
  780.     {
  781.         $this->isDownload $isDownload;
  782.         return $this;
  783.     }
  784.     /**
  785.      * @Groups({"VideoGallery:EL"})
  786.      */
  787.     public function getCntId()
  788.     {
  789.         return $this->container->getId();
  790.     }
  791.     /**
  792.      * @Groups({"VideoGallery:EL"})
  793.      */
  794.     public function getCategory()
  795.     {
  796.         return $this->getVideoGalleryCategory();
  797.     }
  798.     /**
  799.      * @Groups({"VideoGallery:EL"})
  800.      */
  801.     public function getCreated()
  802.     {
  803.         return $this->getCreatedAt();
  804.     }
  805. }