/** * Sets the approval-status of one instagram. Furthermore it dispatches an event. * * @param int $instagramId the instagram id * @param bool $approved whether or not the instagram is approved * @return bool */ public function setApproved($instagramId, $approved) { $repository = $this->em->getRepository($this->socialEntityClass); $instagram = $repository->findOneById($instagramId); if ($instagram == null) { throw new \InvalidArgumentException('The instagram with ID ' . $instagramId . ' could not be found!'); } $instagram->setApproved($approved); $this->em->persist($instagram); $this->em->flush(); $this->dispatcher->dispatch('virtual_identity_instagram.post_approval_change', new InstagramChangedEvent($instagram)); return $approved; }
/** * Sets the approval-status of one youtube. Furthermore it dispatches an event. * * @param int $youtubeId the youtube id * @param bool $approved whether or not the youtube is approved * @return bool */ public function setApproved($youtubeId, $approved) { $repository = $this->em->getRepository($this->socialEntityClass); $youtube = $repository->findOneById($youtubeId); if ($youtube == null) { throw new \InvalidArgumentException('The youtube with ID ' . $youtubeId . ' could not be found!'); } $youtube->setApproved($approved); $this->em->persist($youtube); $this->em->flush(); $this->dispatcher->dispatch('virtual_identity_youtube.post_approval_change', new YoutubeChangedEvent($youtube)); return $approved; }
/** * Sets the approval-status of one facebook. Furthermore it dispatches an event. * * @param int $facebookId the facebook id * @param bool $approved whether or not the facebook is approved * @return bool */ public function setApproved($facebookId, $approved) { $repository = $this->em->getRepository($this->socialEntityClass); $facebook = $repository->findOneById($facebookId); if ($facebook == null) { throw new \InvalidArgumentException('The facebook with ID ' . $facebookId . ' could not be found!'); } $facebook->setApproved($approved); $this->em->persist($facebook); $this->em->flush(); $this->dispatcher->dispatch('virtual_identity_facebook.post_approval_change', new FacebookChangedEvent($facebook)); return $approved; }