/** * @param EventInterface $event * @param null|callable $callback * @throws \Exception */ public function trigger($event, $callback = null) { try { $this->manager->trigger($event, null, null, $callback); } catch (\Exception $ex) { $this->logger->error($ex); throw $ex; } }
/** * @param int $userId */ public function setUserId($userId) { if ($userId !== $this->currentUserId) { static::$logger->debug("User changed '" . $this->currentUserId . "' > '{$userId}'"); $this->currentUserId = $userId; try { $this->setCurrentUserRole($this->getAdapter()->getUserRoleById($userId)); } catch (\Exception $ex) { static::$logger->error($ex); $this->setCurrentUserRole(static::DEFAULT_ROLE); } } }