/**
  * Dispatch event
  *
  * @param Newscoop\Entity\User                 $user
  * @param Newscoop\NewscoopBundle\Entity\Topic $topic
  */
 private function notify(User $user, Topic $topic)
 {
     if (empty($this->dispatcher)) {
         return;
     }
     $this->dispatcher->dispatch('topic.follow', new \Newscoop\EventDispatcher\Events\GenericEvent($this, array('topic_name' => $topic->getName(), 'topic_id' => $topic->getTopicId(), 'user' => $user)));
 }
Exemple #2
0
 /**
  * Dispatch event.
  *
  * @param string $event
  * @param string $subject
  * @param array $params
  */
 protected static function dispatchEvent($event, $subject, $params = array())
 {
     if (empty(self::$eventDispatcher)) {
         return;
     }
     self::$eventDispatcher->notify($event, new GenericEvent($subject, $params));
 }
 /**
  * Dispatch event for plugins permissions
  *
  * @param mixed $subject
  * @param array $options
  *
  * @return array
  */
 public function collectPermissions($subject = null, $options = array())
 {
     $collectedPermissionsData = array();
     $collectedPermissions = $this->dispatcher->dispatch('newscoop.plugins.permissions.register', new PluginPermissionsEvent($subject, $options));
     foreach ($collectedPermissions->getPermissions() as $key => $object) {
         $collectedPermissionsData[$key] = $object;
     }
     return $collectedPermissionsData;
 }
 /**
  * Disable plugin
  * @param  Plugin $plugin
  */
 public function disablePlugin(Plugin $plugin)
 {
     $this->dispatcher->dispatch('plugin.disable', new GenericEvent($this, array('plugin_name' => $plugin->getName(), 'plugin' => $plugin)));
 }