src/Entity/Conference.php line 127

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Util\EsUtil;
  4. use App\Annotation\EsUploadable;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use App\Entity\Model\BulletPoint;
  7. use App\Annotation\EsElasticIndex;
  8. use App\Filter\SearchWithTagFilter;
  9. use App\Filter\ConferenceArchiveFilter;
  10. use App\Repository\ConferenceRepository;
  11. use ApiPlatform\Core\Annotation\ApiFilter;
  12. use App\Entity\Traits\TimestampableEntity;
  13. use Doctrine\Common\Collections\Collection;
  14. use ApiPlatform\Core\Annotation\ApiResource;
  15. use App\Entity\Interfaces\UploadMappedInterface;
  16. use Doctrine\Common\Collections\ArrayCollection;
  17. use App\Entity\Interfaces\ElasticMappedInterface;
  18. use App\Entity\Interfaces\ContainerMappedInterface;
  19. use Symfony\Component\Serializer\Annotation\Groups;
  20. use Symfony\Component\Validator\Constraints as Assert;
  21. use App\Entity\Interfaces\NewsfeedAssetCreatorInterface;
  22. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\DateFilter;
  23. use Symfony\Component\Serializer\Annotation\SerializedName;
  24. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\OrderFilter;
  25. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter;
  26. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\BooleanFilter;
  27. use Locastic\ApiPlatformTranslationBundle\Model\AbstractTranslatable;
  28. use Locastic\ApiPlatformTranslationBundle\Model\TranslationInterface;
  29. /**
  30.  * @ApiResource(
  31.  *      attributes={"filters"={"translation.groups"}},
  32.  *      normalizationContext={"groups"={"Conference:Read"}, "skip_null_values"=false},
  33.  *      denormalizationContext={"groups"={"Conference:Write", "translations"}},
  34.  *      collectionOperations={
  35.  *          "get"={"security"="is_granted('IS_AUTHENTICATED_FULLY')"},
  36.  *          "get_for_event"={
  37.  *              "path"="/conferences/get-for-event",
  38.  *              "method"="GET",
  39.  *              "security"="is_granted('IS_AUTHENTICATED_FULLY')"
  40.  *          },
  41.  *          "get_for_event_all"={
  42.  *              "path"="/conferences/get-for-event-all",
  43.  *              "method"="GET",
  44.  *              "security"="is_granted('IS_AUTHENTICATED_FULLY')",
  45.  *              "normalization_context"={"groups"={"Conference:PRead"}, "skip_null_values"=false}
  46.  *          },
  47.  *          "get_for_select"={
  48.  *              "path"="/conferences/get-for-select",
  49.  *              "method"="GET",
  50.  *              "security"="is_granted('IS_AUTHENTICATED_FULLY')",
  51.  *              "normalization_context"={"groups"={"Conference:Select"}, "skip_null_values"=false},
  52.  *              "pagination_enabled"=false
  53.  *          },
  54.  *          "get_for_public_page"={
  55.  *              "route_name"="api_pub_conferences_get_for_public_page_collection",
  56.  *              "method"="GET",
  57.  *              "security"="is_granted('PUBLIC_ACCESS')",
  58.  *              "normalization_context"={"groups"={"Conference:PRead"}, "skip_null_values"=false},
  59.  *              "pagination_enabled"=true
  60.  *          },
  61.  *          "get_all"={
  62.  *              "path"="/conferences/get-all",
  63.  *              "method"="GET",
  64.  *              "security"="is_granted('IS_AUTHENTICATED_FULLY')",
  65.  *              "pagination_enabled"=false
  66.  *          },
  67.  *          "post"={"security"="is_granted('ROLE_OPERATOR')"},
  68.  *          "post_clone"={
  69.  *              "route_name"="api_conferences_clone_collection",
  70.  *              "method"="POST",
  71.  *              "denormalization_context"={"groups"={"Conference:Clone"}},
  72.  *              "security"="is_granted('ROLE_OPERATOR')"
  73.  *          },
  74.  *          "post_certificate_prepare"={
  75.  *              "route_name"="api_conferences_certificate_prepare",
  76.  *              "method"="POST",
  77.  *              "denormalization_context"={"groups"={"Conference:Clone"}},
  78.  *              "security"="is_granted('ROLE_OPERATOR')"
  79.  *          },
  80.  *          "post_certificate_send"={
  81.  *              "route_name"="api_conferences_certificate_send",
  82.  *              "method"="POST",
  83.  *              "denormalization_context"={"groups"={"Conference:Clone"}},
  84.  *              "security"="is_granted('ROLE_OPERATOR')"
  85.  *          }
  86.  *      },
  87.  *      itemOperations={
  88.  *          "get"={
  89.  *              "security"="is_granted('IS_CO_ANY', object)",
  90.  *              "normalization_context"={"groups"={"Conference:Read", "Conference:SessionDate"}, "skip_null_values"=false},
  91.  *          },
  92.  *          "get_for_public_item_page"={
  93.  *              "route_name"="api_pub_conferences_get_for_public_page_item",
  94.  *              "method"="GET",
  95.  *              "security"="is_granted('PUBLIC_ACCESS')",
  96.  *              "normalization_context"={"groups"={"Conference:PRead"}, "skip_null_values"=false}
  97.  *          },
  98.  *          "put"={"security"="is_granted('IS_CO_OPR', object)"},
  99.  *          "patch"={"security"="is_granted('IS_CO_OPR', object)"},
  100.  *          "patch_register"={
  101.  *              "route_name"="api_conferences_register",
  102.  *              "method"="PATCH",
  103.  *              "denormalization_context"={"groups"={"Conference:Register"}},
  104.  *              "security"="is_granted('IS_AUTHENTICATED_FULLY')"
  105.  *          },
  106.  *          "patch_unregister"={
  107.  *              "route_name"="api_conferences_unregister",
  108.  *              "method"="PATCH",
  109.  *              "denormalization_context"={"groups"={"Conference:Unregister"}},
  110.  *              "security"="is_granted('IS_AUTHENTICATED_FULLY')"
  111.  *          },
  112.  *          "delete"={"security"="is_granted('IS_CO_OPR', object)"}
  113.  *     }
  114.  * )
  115.  * @ApiFilter(SearchFilter::class, properties={"container.id": "exact", "conferenceTags.id": "exact", "conferenceCategory.id": "exact", "certificateTemplate.id": "exact", "translations.title": "partial", "companies.id": "exact", "conferenceCredits.creditCategory.id": "exact", "conferenceLanguage": "exact", "speakers.id": "exact", "companies.id": "exact"})
  116.  * @ApiFilter(SearchWithTagFilter::class, properties={"search_with_tag": "partial"})
  117.  * @ApiFilter(DateFilter::class, properties={"startAt", "endAt"})
  118.  * @ApiFilter(BooleanFilter::class, properties={"isCertificate", "isRegisterEnable"})
  119.  * @ApiFilter(ConferenceArchiveFilter::class, properties={"is_archive"})
  120.  * @ApiFilter(OrderFilter::class, properties={"id", "startAt", "translations.title": "ASC", "ord"})
  121.  * @ORM\Entity(repositoryClass=ConferenceRepository::class)
  122.  * @EsElasticIndex("Conference:EL")
  123.  */
  124. class Conference extends AbstractTranslatable implements ContainerMappedInterfaceUploadMappedInterfaceNewsfeedAssetCreatorInterfaceElasticMappedInterface
  125. {
  126.     /**
  127.      * Hook timestampable behavior
  128.      * updates createdAt, updatedAt fields
  129.      */
  130.     use TimestampableEntity;
  131.     /**
  132.      * @ORM\OneToMany(targetEntity="ConferenceTranslation", mappedBy="translatable", fetch="EXTRA_LAZY", indexBy="locale", cascade={"PERSIST"}, orphanRemoval=true)
  133.      *
  134.      * @Groups({"Conference:EL", "Conference:Write", "translations", "Session:VideoLibrary", "Conference:PRead"})
  135.      * @Assert\Valid()
  136.      */
  137.     protected $translations;
  138.     /**
  139.      * @Groups({"Conference:Select", "Conference:Read", "Conference:PRead", "Session:Read-Watched", "Session:Read", "Session:GetItemDetail", "Session:VideoGallery", "Session:VideoLibrary", "Certificate:Read"})
  140.      */
  141.     private $title;
  142.     /**
  143.      * @Groups({"Conference:Read", "Conference:PRead"})
  144.      */
  145.     private $description;
  146.     /**
  147.      * @ORM\Id
  148.      * @ORM\GeneratedValue
  149.      * @ORM\Column(type="integer")
  150.      * @Groups({"Conference:EL", "Conference:Select", "Conference:Read", "Conference:PRead", "Session:Read", "Session:GetItemDetail", "VoteQuestion:Read", "Session:VideoGallery", "Certificate:Read"})
  151.      */
  152.     private $id;
  153.     /**
  154.      * @ORM\Column(type="string", length=255, nullable=true)
  155.      *
  156.      * @Groups({"Conference:EL", "Conference:Select", "Conference:Read", "Conference:PRead", "Conference:Write"})
  157.      *
  158.      * @Assert\Length(max=255, maxMessage="validation.conference:imageName.max")
  159.      * @EsUploadable()
  160.      */
  161.     protected $imageName;
  162.     /**
  163.      * @ORM\Column(type="boolean")
  164.      *
  165.      * @Groups({"Conference:Read", "Conference:Write"})
  166.      *
  167.      * @Assert\Type(type="bool", message="validation.conference:isVisible.typeBool")
  168.      */
  169.     private $isVisible;
  170.     /**
  171.      * @ORM\ManyToOne(targetEntity=Container::class)
  172.      * @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
  173.      *
  174.      * @Groups({"Conference:Read", "Conference:PRead", "Conference:Write"})
  175.      */
  176.     private $container;
  177.     /**
  178.      * @ORM\OneToMany(targetEntity=Session::class, mappedBy="conference", orphanRemoval=true)
  179.      */
  180.     private $sessions;
  181.     /**
  182.      * @ORM\ManyToMany(targetEntity=ConferenceTag::class, inversedBy="conferences", cascade={"persist"})
  183.      *
  184.      * @Groups({"Conference:Read", "Conference:Write", "Conference:PRead"})
  185.      */
  186.     private $conferenceTags;
  187.     /**
  188.      * @ORM\Column(type="datetime", nullable=true)
  189.      *
  190.      * @Groups({"Conference:EL", "Conference:Read", "Conference:PRead", "Session:VideoGallery"})
  191.      */
  192.     private $startAt;
  193.     /**
  194.      * @Groups({"Conference:Clone"})
  195.      */
  196.     private int $cloneId;
  197.     private $sessionDates false;
  198.     /**
  199.      * @ORM\Column(type="datetime", nullable=true)
  200.      *
  201.      * @Groups({"Conference:EL", "Conference:Read", "Conference:PRead", "Session:VideoGallery"})
  202.      */
  203.     private $endAt;
  204.     /**
  205.      * @ORM\Column(type="boolean", nullable=true)
  206.      * @Groups({"Conference:Write", "Conference:Read"})
  207.      */
  208.     private $isReminderBeforeStart;
  209.     /**
  210.      * @ORM\Column(type="integer", nullable=true)
  211.      * @Groups({"Conference:Write", "Conference:Read"})
  212.      */
  213.     private $reminderBeforeStart;
  214.     /**
  215.      * @ORM\ManyToMany(targetEntity=User::class)
  216.      * @ORM\JoinTable(name="rel_conference_speaker")
  217.      * @Groups({"Conference:EL", "Conference:Write", "Conference:Read", "Conference:PRead"})
  218.      * @ORM\OrderBy({"lastName" = "ASC"})
  219.      */
  220.     private $speakers;
  221.     /**
  222.      * @ORM\ManyToMany(targetEntity=User::class)
  223.      * @ORM\JoinTable(name="rel_conference_moderator")
  224.      * @Groups({"Conference:EL", "Conference:Write", "Conference:Read", "Conference:PRead"})
  225.      * @ORM\OrderBy({"lastName" = "ASC"})
  226.      */
  227.     private $moderators;
  228.     /**
  229.      * @ORM\Column(type="integer", nullable=true)
  230.      * @Groups({"Conference:Read", "Conference:Write"})
  231.      */
  232.     private $ord;
  233.     /**
  234.      * @ORM\Column(type="boolean", nullable=true)
  235.      * @Groups({"Conference:Read", "Conference:Write"})
  236.      */
  237.     private $isShowPublic;
  238.     /**
  239.      * @ORM\ManyToOne(targetEntity=CommonCategory::class)
  240.      * @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
  241.      * @Groups({"Conference:Read", "Conference:Write", "Conference:PRead"})
  242.      */
  243.     private $conferenceCategory;
  244.     /**
  245.      * @ORM\Column(type="boolean", nullable=true)
  246.      * @Groups({"Conference:Read", "Conference:PRead"})
  247.      */
  248.     private $isLive;
  249.     /**
  250.      * @ORM\ManyToMany(targetEntity=UserGroup::class, inversedBy="conferences")
  251.      * @Groups({"Conference:Read", "Conference:Write"})
  252.      */
  253.     private $userGroups;
  254.     /**
  255.      * @ORM\Column(type="boolean", nullable=true)
  256.      * @Groups({"Conference:Read", "Conference:Write", "Session:Read"})
  257.      */
  258.     private $isUseUserGroup;
  259.     /**
  260.      * @Groups({"Conference:Write"})
  261.      */
  262.     private $isUserGroupChange;
  263.     /**
  264.      * @ORM\Column(type="array", nullable=true)
  265.      * @Groups({"Conference:Read", "Conference:Write", "Conference:PRead"})
  266.      */
  267.     private $bulletPoints = [];
  268.     /**
  269.      * @ORM\Column(type="boolean", nullable=true)
  270.      * @Groups({"Conference:Read", "Conference:Write", "Conference:PRead"})
  271.      */
  272.     private $isCertificate;
  273.     /**
  274.      * @ORM\ManyToOne(targetEntity=CertificateTemplate::class)
  275.      * @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
  276.      * @Groups({"Conference:Read", "Conference:Write"})
  277.      */
  278.     private $certificateTemplate;
  279.     /**
  280.      * @ORM\Column(type="integer", nullable=true)
  281.      * @Groups({"Conference:Read", "Conference:Write"})
  282.      */
  283.     private $watchTime;
  284.     /**
  285.      * @ORM\Column(type="integer", nullable=true)
  286.      */
  287.     private $oldId;
  288.     /**
  289.      * @ORM\Column(type="string", length=64, nullable=true)
  290.      * @Groups({"Conference:Read", "Conference:Write", "Conference:PRead", "Session:Read", "Session:GetItemDetail"})
  291.      */
  292.     private $timezone;
  293.     /**
  294.      * @ORM\Column(type="boolean", nullable=true)
  295.      * @Groups({"Conference:Read", "Conference:Write", "Conference:PRead", "Session:GetItemDetail"})
  296.      */
  297.     private $isRegisterEnable;
  298.     /**
  299.      * @ORM\Column(type="integer", nullable=true)
  300.      * @Groups({"Conference:Read", "Conference:Write", "Conference:PRead"})
  301.      */
  302.     private $totalSeats;
  303.     /**
  304.      * @ORM\Column(type="integer", nullable=true)
  305.      * @Groups({"Conference:Read", "Conference:PRead"})
  306.      */
  307.     private $availableSeats;
  308.     /**
  309.      * @ORM\ManyToMany(targetEntity=User::class, inversedBy="registeredToConferences")
  310.      */
  311.     private $registeredUsers;
  312.     /**
  313.      * @Groups({"Conference:Unregister"})
  314.      */
  315.     private $unregisterUserId;
  316.     /**
  317.      * @ORM\Column(type="boolean", nullable=true)
  318.      * @Groups({"Conference:Read", "Conference:Write"})
  319.      */
  320.     private $isCertificateForReply;
  321.     /**
  322.      * @ORM\OneToMany(targetEntity=ConferenceCredit::class, mappedBy="conference", orphanRemoval=true, cascade={"persist"})
  323.      * @Groups({"Conference:Read", "Conference:Write", "Conference:PRead"})
  324.      */
  325.     private $conferenceCredits;
  326.     /**
  327.      * @ORM\Column(type="string", length=64, nullable=true)
  328.      * @Groups({"Conference:Read", "Conference:Write", "Conference:PRead"})
  329.      */
  330.     private $conferenceLanguage;
  331.     /**
  332.      * @ORM\Column(type="string", length=255, nullable=true)
  333.      * @Groups({"Conference:Read", "Conference:Write", "Conference:PRead"})
  334.      */
  335.     private $location;
  336.     /**
  337.      * @ORM\ManyToMany(targetEntity=Company::class)
  338.      * @Groups({"Conference:Write", "Conference:Read", "Conference:PRead", "Session:GetItemDetail"})
  339.      */
  340.     private $companies;
  341.     public function __construct()
  342.     {
  343.         parent::__construct();
  344.         $this->sessions = new ArrayCollection();
  345.         $this->conferenceTags = new ArrayCollection();
  346.         $this->speakers = new ArrayCollection();
  347.         $this->moderators = new ArrayCollection();
  348.         $this->userGroups = new ArrayCollection();
  349.         $bulletPointModel = new BulletPoint();
  350.         $this->bulletPoints $bulletPointModel->getProperties();
  351.         $this->registeredUsers = new ArrayCollection();
  352.         $this->conferenceCredits = new ArrayCollection();
  353.         $this->companies = new ArrayCollection();
  354.     }
  355.     protected function createTranslation(): TranslationInterface
  356.     {
  357.         return new ConferenceTranslation();
  358.     }
  359.     public function addTranslation(TranslationInterface $translation): void
  360.     {
  361.         $this->setUpdatedAt(new \DateTime());
  362.         parent::addTranslation($translation);
  363.     }
  364.     public function getTitle(): ?string
  365.     {
  366.         return $this->getTranslation()->getTitle();
  367.     }
  368.     public function setTitle(string $title): self
  369.     {
  370.         $this->getTranslation()->setTitle($title);
  371.         return $this;
  372.     }
  373.     public function getDescription(): ?string
  374.     {
  375.         return $this->getTranslation()->getDescription();
  376.     }
  377.     public function setDescription(string $description): self
  378.     {
  379.         $this->getTranslation()->setDescription($description);
  380.         return $this;
  381.     }
  382.     public function getId(): ?int
  383.     {
  384.         return $this->id;
  385.     }
  386.     public function getImageName(): ?string
  387.     {
  388.         return $this->imageName;
  389.     }
  390.     public function setImageName(?string $imageName): self
  391.     {
  392.         $this->imageName $imageName;
  393.         return $this;
  394.     }
  395.     public function getIsVisible(): ?bool
  396.     {
  397.         return $this->isVisible;
  398.     }
  399.     public function setIsVisible(bool $isVisible): self
  400.     {
  401.         $this->isVisible $isVisible;
  402.         return $this;
  403.     }
  404.     public function getContainer(): ?Container
  405.     {
  406.         return $this->container;
  407.     }
  408.     public function setContainer(?Container $container): self
  409.     {
  410.         $this->container $container;
  411.         return $this;
  412.     }
  413.     /**
  414.      * @return Collection|Session[]
  415.      */
  416.     public function getSessions()
  417.     {
  418.         return $this->sessions;
  419.     }
  420.     public function addSession(Session $session): self
  421.     {
  422.         if (!$this->sessions->contains($session)) {
  423.             $this->sessions[] = $session;
  424.             $session->setConference($this);
  425.         }
  426.         return $this;
  427.     }
  428.     public function removeSession(Session $session): self
  429.     {
  430.         if ($this->sessions->removeElement($session)) {
  431.             // set the owning side to null (unless already changed)
  432.             if ($session->getConference() === $this) {
  433.                 $session->setConference(null);
  434.             }
  435.         }
  436.         return $this;
  437.     }
  438.     /**
  439.      * @return Collection|ConferenceTag[]
  440.      */
  441.     public function getConferenceTags()
  442.     {
  443.         return $this->conferenceTags;
  444.     }
  445.     /**
  446.      * @Groups({"Conference:EL"})
  447.      * @SerializedName("tags")
  448.      */
  449.     public function getTagsArray()
  450.     {
  451.         $tags = [];
  452.         foreach ($this->conferenceTags as $tag) {
  453.             $tags[] = $tag->getName();
  454.         }
  455.         return $tags;
  456.     }
  457.     public function addConferenceTag(ConferenceTag $conferenceTag): self
  458.     {
  459.         if (!$this->conferenceTags->contains($conferenceTag)) {
  460.             $this->conferenceTags[] = $conferenceTag;
  461.         }
  462.         return $this;
  463.     }
  464.     public function removeConferenceTag(ConferenceTag $conferenceTag): self
  465.     {
  466.         $this->conferenceTags->removeElement($conferenceTag);
  467.         return $this;
  468.     }
  469.     public function removeAllConferenceTags(): self
  470.     {
  471.         foreach ($this->conferenceTags as $tag) {
  472.             $this->removeConferenceTag($tag);
  473.         }
  474.         return $this;
  475.     }
  476.     public function reAttachTags(): self
  477.     {
  478.         $tags $this->conferenceTags;
  479.         foreach ($tags as $tag) {
  480.             $nt = clone $tag;
  481.             $nt->setContainer($this->getContainer());
  482.             $this->removeConferenceTag($tag);
  483.             $this->addConferenceTag($nt);
  484.         }
  485.         return $this;
  486.     }
  487.     public function getStartAt(): ?\DateTimeInterface
  488.     {
  489.         return $this->startAt;
  490.     }
  491.     public function setStartAt(?\DateTimeInterface $startAt): self
  492.     {
  493.         $this->startAt $startAt;
  494.         return $this;
  495.     }
  496.     public function getCloneId()
  497.     {
  498.         return $this->cloneId;
  499.     }
  500.     public function setCloneId($cloneId)
  501.     {
  502.         $this->cloneId $cloneId;
  503.         return $this;
  504.     }
  505.     /**
  506.      * @Groups({"Conference:SessionDate"})
  507.      */
  508.     public function getSessionDates(): array
  509.     {
  510.         if (is_array($this->sessionDates) && count($this->sessionDates) > 0) {
  511.             return $this->sessionDates;
  512.         }
  513.         return [];
  514.         /*
  515.         $dates = [];
  516.         $sessions = $this->getSessions();
  517.         foreach ($sessions as $session) {
  518.             $start = clone $session->getStart();
  519.             //$start->setTimezone(new \DateTimeZone('UTC'));
  520.             //$start->setTime(0, 0, 0);
  521.             if (!isset($dates[$start->format('Ymd')])) {
  522.                 $dates[$start->format('Ymd')] = $start;
  523.             }
  524.         }
  525.         return $dates;
  526.         */
  527.     }
  528.     public function setSessionDates($sessionDates)
  529.     {
  530.         $this->sessionDates $sessionDates;
  531.     }
  532.     public function getEndAt(): ?\DateTimeInterface
  533.     {
  534.         return $this->endAt;
  535.     }
  536.     public function setEndAt(?\DateTimeInterface $endAt): self
  537.     {
  538.         $this->endAt $endAt;
  539.         return $this;
  540.     }
  541.     /**
  542.      * @Groups({"Conference:Read"})
  543.      */
  544.     public function getCurrentTime()
  545.     {
  546.         return new \DateTime();
  547.     }
  548.     /**
  549.      * @Groups({"Conference:Read", "Conference:PRead"})
  550.      */
  551.     /*
  552.     public function getIsLive()
  553.     {
  554.         if (!$this->startAt || !$this->endAt) {
  555.             return false;
  556.         }
  557.         $ct = EsUtil::convertToUTCTime(new \DateTime());
  558.         $s = EsUtil::convertToUTCTime(clone $this->startAt);
  559.         $e = EsUtil::convertToUTCTime(clone $this->endAt);
  560.         return ($s && $e && $ct >= $s && $ct < $e);
  561.     }
  562.     */
  563.     /**
  564.      * @Groups({"Conference:Read", "Session:GetItemDetail"})
  565.      */
  566.     public function getIsArchive()
  567.     {
  568.         if ($this->getEndAt() && $this->getCurrentTime() > $this->getEndAt()) {
  569.             return true;
  570.         }
  571.         return false;
  572.     }
  573.     public function getIsReminderBeforeStart(): ?bool
  574.     {
  575.         return $this->isReminderBeforeStart;
  576.     }
  577.     public function setIsReminderBeforeStart(?bool $isReminderBeforeStart): self
  578.     {
  579.         $this->isReminderBeforeStart $isReminderBeforeStart;
  580.         return $this;
  581.     }
  582.     public function getReminderBeforeStart(): ?int
  583.     {
  584.         return $this->reminderBeforeStart;
  585.     }
  586.     public function setReminderBeforeStart(?int $reminderBeforeStart): self
  587.     {
  588.         $this->reminderBeforeStart $reminderBeforeStart;
  589.         return $this;
  590.     }
  591.     /**
  592.      * @return Collection|User[]
  593.      */
  594.     public function getSpeakers(): Collection
  595.     {
  596.         return $this->speakers;
  597.     }
  598.     public function addSpeaker(User $speaker): self
  599.     {
  600.         if (!$this->speakers->contains($speaker)) {
  601.             $this->speakers[] = $speaker;
  602.         }
  603.         return $this;
  604.     }
  605.     public function removeSpeaker(User $speaker): self
  606.     {
  607.         $this->speakers->removeElement($speaker);
  608.         return $this;
  609.     }
  610.     public function removeAllSpeakers(): self
  611.     {
  612.         foreach ($this->speakers as $speaker) {
  613.             $this->speakers->removeElement($speaker);
  614.         }
  615.         return $this;
  616.     }
  617.     /**
  618.      * @return Collection|User[]
  619.      */
  620.     public function getModerators(): Collection
  621.     {
  622.         return $this->moderators;
  623.     }
  624.     public function addModerator(User $moderator): self
  625.     {
  626.         if (!$this->moderators->contains($moderator)) {
  627.             $this->moderators[] = $moderator;
  628.         }
  629.         return $this;
  630.     }
  631.     public function removeModerator(User $moderator): self
  632.     {
  633.         $this->moderators->removeElement($moderator);
  634.         return $this;
  635.     }
  636.     public function removeAllModerators(): self
  637.     {
  638.         foreach ($this->moderators as $moderator) {
  639.             $this->moderators->removeElement($moderator);
  640.         }
  641.         return $this;
  642.     }
  643.     public function getClone(Conference $source null): self
  644.     {
  645.         if (empty($source)) {
  646.             $source $this;
  647.         }
  648.         $target = new Conference();
  649.         $target
  650.             ->setStartAt($source->getStartAt())
  651.             ->setEndAt($source->getEndAt())
  652.             ->setImageName($source->getImageName())
  653.             ->setIsVisible($source->getIsVisible())
  654.             ->setIsReminderBeforeStart($source->getIsReminderBeforeStart())
  655.             ->setReminderBeforeStart($source->getReminderBeforeStart())
  656.             ->setContainer($source->getContainer())
  657.             ->setConferenceCategory($source->getConferenceCategory())
  658.             ->setIsLive($source->getIsLive())
  659.             ->setBulletPoints($source->getBulletPoints())
  660.             ->setTimezone($source->getTimezone())
  661.         ;
  662.         foreach ($source->getTranslations() as $s) {
  663.             $newT = new ConferenceTranslation();
  664.             $newT
  665.                 ->setTitle($s->getTitle().' (copy)')
  666.                 ->setDescription($s->getDescription())
  667.                 ->setLocale($s->getLocale())
  668.             ;
  669.             $target->addTranslation($newT);
  670.         }
  671.         foreach ($source->getSpeakers() as $s) {
  672.             $target->addSpeaker($s);
  673.         }
  674.         foreach ($source->getModerators() as $s) {
  675.             $target->addModerator($s);
  676.         }
  677.         foreach ($source->getConferenceTags() as $s) {
  678.             $target->addConferenceTag($s);
  679.         }
  680.         $target->setIsUseUserGroup($source->getIsUseUserGroup());
  681.         foreach ($source->getUserGroups() as $s) {
  682.             $target->addUserGroup($s);
  683.         }
  684.         return $target;
  685.     }
  686.     public function getOrd(): ?int
  687.     {
  688.         return $this->ord;
  689.     }
  690.     public function setOrd(?int $ord): self
  691.     {
  692.         $this->ord $ord;
  693.         return $this;
  694.     }
  695.     public function getIsShowPublic(): ?bool
  696.     {
  697.         return $this->isShowPublic;
  698.     }
  699.     public function setIsShowPublic(?bool $isShowPublic): self
  700.     {
  701.         $this->isShowPublic $isShowPublic;
  702.         return $this;
  703.     }
  704.     public function getConferenceCategory(): ?CommonCategory
  705.     {
  706.         return $this->conferenceCategory;
  707.     }
  708.     public function setConferenceCategory(?CommonCategory $conferenceCategory): self
  709.     {
  710.         $this->conferenceCategory $conferenceCategory;
  711.         return $this;
  712.     }
  713.     public function getIsLive(): ?bool
  714.     {
  715.         return $this->isLive;
  716.     }
  717.     public function setIsLive(?bool $isLive): self
  718.     {
  719.         $this->isLive $isLive;
  720.         return $this;
  721.     }
  722.     /**
  723.      * @return Collection<int, UserGroup>
  724.      */
  725.     public function getUserGroups(): Collection
  726.     {
  727.         return $this->userGroups;
  728.     }
  729.     /**
  730.      * @Groups({"Conference:EL"})
  731.      * @SerializedName("groups")
  732.      */
  733.     public function getUserGroupsArray()
  734.     {
  735.         $groups = [];
  736.         foreach ($this->userGroups as $group) {
  737.             if (!$group->getIsGenerated()) {
  738.                 $groups[] = $group->getId();
  739.             }
  740.         }
  741.         return $groups;
  742.     }
  743.     public function addUserGroup(UserGroup $userGroup): self
  744.     {
  745.         if (!$this->userGroups->contains($userGroup)) {
  746.             $this->userGroups[] = $userGroup;
  747.         }
  748.         return $this;
  749.     }
  750.     public function removeUserGroup(UserGroup $userGroup): self
  751.     {
  752.         $this->userGroups->removeElement($userGroup);
  753.         return $this;
  754.     }
  755.     public function removeAllUserGroups(): self
  756.     {
  757.         foreach ($this->userGroups as $userGroup) {
  758.             $this->removeUserGroup($userGroup);
  759.         }
  760.         return $this;
  761.     }
  762.     public function getIsUseUserGroup(): ?bool
  763.     {
  764.         return $this->isUseUserGroup;
  765.     }
  766.     public function setIsUseUserGroup(?bool $isUseUserGroup): self
  767.     {
  768.         $this->isUseUserGroup $isUseUserGroup;
  769.         return $this;
  770.     }
  771.     public function getIsUserGroupChange()
  772.     {
  773.         return $this->isUserGroupChange;
  774.     }
  775.     public function setIsUserGroupChange($isUserGroupChange)
  776.     {
  777.         $this->isUserGroupChange $isUserGroupChange;
  778.         return $this;
  779.     }
  780.     public function getBulletPoints(): ?array
  781.     {
  782.         if ($this->bulletPoints === null) {
  783.             $this->bulletPoints = [];
  784.         }
  785.         return $this->bulletPoints;
  786.     }
  787.     public function setBulletPoints(?array $bulletPoints): self
  788.     {
  789.         if (!is_array($bulletPoints)) {
  790.             return $this;
  791.         }
  792.         $this->bulletPoints $bulletPoints;
  793.         return $this;
  794.     }
  795.     public function getAllBulletPoints($locale 'en')
  796.     {
  797.         $bp = [];
  798.         foreach ($this->bulletPoints as $c) {
  799.             if (isset($c['translations'])) {
  800.                 foreach ($c['translations'] as $t) {
  801.                     if ($t['locale'] === $locale) {
  802.                         $bp[] = $t['info'];
  803.                     }
  804.                 }
  805.             }
  806.         }
  807.         return implode('</br>'$bp);
  808.     }
  809.     public function getIsCertificate(): ?bool
  810.     {
  811.         return $this->isCertificate;
  812.     }
  813.     public function setIsCertificate(?bool $isCertificate): self
  814.     {
  815.         $this->isCertificate $isCertificate;
  816.         return $this;
  817.     }
  818.     public function getCertificateTemplate(): ?CertificateTemplate
  819.     {
  820.         return $this->certificateTemplate;
  821.     }
  822.     public function setCertificateTemplate(?CertificateTemplate $certificateTemplate): self
  823.     {
  824.         $this->certificateTemplate $certificateTemplate;
  825.         return $this;
  826.     }
  827.     public function getWatchTime(): ?int
  828.     {
  829.         return $this->watchTime;
  830.     }
  831.     public function setWatchTime(?int $watchTime): self
  832.     {
  833.         $this->watchTime $watchTime;
  834.         return $this;
  835.     }
  836.     public function getIsPostEnable()
  837.     {
  838.         return true;
  839.     }
  840.     public function getPostPoster()
  841.     {
  842.         return $this->getImageName();
  843.     }
  844.     public function getMetadataTranslation()
  845.     {
  846.         $translations = [];
  847.         foreach ($this->getTranslations() as $translation) {
  848.             $translations[] = [
  849.                 $translation->getLocale() => [
  850.                     'title' => $translation->getTitle(),
  851.                     'description' => $translation->getDescription()
  852.                 ]
  853.             ];
  854.         }
  855.         return $translations;
  856.     }
  857.     public function getPostMetadata()
  858.     {
  859.         return [
  860.             'conference' => [
  861.                 'id' => $this->getId(),
  862.                 'translations' => $this->getMetadataTranslation(),
  863.                 'tags' => $this->getTagsArray(),
  864.                 'conferenceCategory' => $this->getConferenceCategory() ? $this->getConferenceCategory()->getMeta() : null
  865.             ]
  866.         ];
  867.     }
  868.     public function getPostUserGroups()
  869.     {
  870.         return $this->getUserGroups();
  871.     }
  872.     public function getPostSubSource()
  873.     {
  874.         return Newsfeed::POSTSUBTYPE_CONFERENCE;
  875.     }
  876.     public function getOldId(): ?int
  877.     {
  878.         return $this->oldId;
  879.     }
  880.     public function setOldId(?int $oldId): self
  881.     {
  882.         $this->oldId $oldId;
  883.         return $this;
  884.     }
  885.     public function getTimezone(): ?string
  886.     {
  887.         return $this->timezone;
  888.     }
  889.     public function setTimezone(?string $timezone): self
  890.     {
  891.         $this->timezone $timezone;
  892.         return $this;
  893.     }
  894.     public function getIsRegisterEnable(): ?bool
  895.     {
  896.         return $this->isRegisterEnable;
  897.     }
  898.     public function setIsRegisterEnable(?bool $isRegisterEnable): self
  899.     {
  900.         $this->isRegisterEnable $isRegisterEnable;
  901.         return $this;
  902.     }
  903.     public function getTotalSeats(): ?int
  904.     {
  905.         return $this->totalSeats;
  906.     }
  907.     public function setTotalSeats(?int $totalSeats): self
  908.     {
  909.         $this->totalSeats $totalSeats;
  910.         $this->calculateAvailableSeats();
  911.         return $this;
  912.     }
  913.     public function getAvailableSeats(): ?int
  914.     {
  915.         return $this->availableSeats;
  916.     }
  917.     public function setAvailableSeats(?int $availableSeats): self
  918.     {
  919.         $this->availableSeats $availableSeats;
  920.         return $this;
  921.     }
  922.     /**
  923.      * @return Collection<int, User>
  924.      */
  925.     public function getRegisteredUsers(): Collection
  926.     {
  927.         return $this->registeredUsers;
  928.     }
  929.     public function addRegisteredUser(User $registeredUser): self
  930.     {
  931.         if (!$this->registeredUsers->contains($registeredUser)) {
  932.             $this->registeredUsers[] = $registeredUser;
  933.         }
  934.         $this->calculateAvailableSeats();
  935.         return $this;
  936.     }
  937.     public function removeRegisteredUser(User $registeredUser): self
  938.     {
  939.         $this->registeredUsers->removeElement($registeredUser);
  940.         $this->calculateAvailableSeats();
  941.         return $this;
  942.     }
  943.     public function hasRegisteredUser(User $registeredUser): bool
  944.     {
  945.         return $this->registeredUsers->contains($registeredUser);
  946.     }
  947.     public function calculateAvailableSeats()
  948.     {
  949.         $totalRegistered $this->registeredUsers?->count();
  950.         $this->setAvailableSeats($this->totalSeats $totalRegistered);
  951.     }
  952.     public function getUnregisterUserId()
  953.     {
  954.         return $this->unregisterUserId;
  955.     }
  956.     public function setUnregisterUserId($unregisterUserId): self
  957.     {
  958.         $this->unregisterUserId $unregisterUserId;
  959.         return $this;
  960.     }
  961.     public function getIsCertificateForReply(): ?bool
  962.     {
  963.         return $this->isCertificateForReply;
  964.     }
  965.     public function setIsCertificateForReply(?bool $isCertificateForReply): self
  966.     {
  967.         $this->isCertificateForReply $isCertificateForReply;
  968.         return $this;
  969.     }
  970.     /**
  971.      * @Groups({"Conference:EL"})
  972.      */
  973.     public function getCntId()
  974.     {
  975.         return $this->container->getId();
  976.     }
  977.     /**
  978.      * @Groups({"Conference:EL"})
  979.      */
  980.     public function getCategory()
  981.     {
  982.         return $this->getConferenceCategory();
  983.     }
  984.     /**
  985.      * @return Collection<int, ConferenceCredit>
  986.      */
  987.     public function getConferenceCredits(): Collection
  988.     {
  989.         return $this->conferenceCredits;
  990.     }
  991.     public function addConferenceCredit(ConferenceCredit $conferenceCredit): self
  992.     {
  993.         if (!$this->conferenceCredits->contains($conferenceCredit)) {
  994.             $this->conferenceCredits[] = $conferenceCredit;
  995.             $conferenceCredit->setConference($this);
  996.         }
  997.         return $this;
  998.     }
  999.     public function removeConferenceCredit(ConferenceCredit $conferenceCredit): self
  1000.     {
  1001.         // if ($this->conferenceCredits->removeElement($conferenceCredit)) {
  1002.         //     // set the owning side to null (unless already changed)
  1003.         //     if ($conferenceCredit->getConference() === $this) {
  1004.         //         $conferenceCredit->setConference(null);
  1005.         //     }
  1006.         // }
  1007.         $this->conferenceCredits->removeElement($conferenceCredit);
  1008.         return $this;
  1009.     }
  1010.     public function getTotalCredit()
  1011.     {
  1012.         $total 0.0;
  1013.         foreach ($this->conferenceCredits as $c) {
  1014.             $total += (float) $c->getCreditPoint();
  1015.         }
  1016.         return $total;
  1017.     }
  1018.     public function getAllCredit()
  1019.     {
  1020.         $allCredit = [];
  1021.         foreach ($this->conferenceCredits as $c) {
  1022.             $allCredit[] = $c->getCreditCategory()->getName().': '.$c->getCreditPoint();
  1023.         }
  1024.         return implode('</br>'$allCredit);
  1025.     }
  1026.     public function getConferenceLanguage(): ?string
  1027.     {
  1028.         return $this->conferenceLanguage;
  1029.     }
  1030.     public function setConferenceLanguage(?string $conferenceLanguage): self
  1031.     {
  1032.         $this->conferenceLanguage $conferenceLanguage;
  1033.         return $this;
  1034.     }
  1035.     public function getLocation(): ?string
  1036.     {
  1037.         return $this->location;
  1038.     }
  1039.     public function setLocation(?string $location): self
  1040.     {
  1041.         $this->location $location;
  1042.         return $this;
  1043.     }
  1044.     /**
  1045.      * @return Collection<int, Company>
  1046.      */
  1047.     public function getCompanies(): Collection
  1048.     {
  1049.         return $this->companies;
  1050.     }
  1051.     public function addCompany(Company $company): self
  1052.     {
  1053.         if (!$this->companies->contains($company)) {
  1054.             $this->companies[] = $company;
  1055.         }
  1056.         return $this;
  1057.     }
  1058.     public function removeCompany(Company $company): self
  1059.     {
  1060.         $this->companies->removeElement($company);
  1061.         return $this;
  1062.     }
  1063. }