public function initSubscriptionsForUser($userId) { // User Directed Events $this->subscribe($userId, 'USER.' . $userId); $pdo = new ForumServicePDO(); $forums = $pdo->getForumsForUser($userId); foreach ($forums as $forum) { $this->subscribe($userId, 'FORUM.' . $forum['id']); } }
/** * * @see ForumServicePDO::getForumsForUser() */ public static function getForumsForUser() { try { $pdo = new ForumServicePDO(); $userId = AppUtils::getUserId(); $forums = $pdo->getForumsForUser($userId); AppUtils::sendResponse($forums); } catch (PDOException $e) { AppUtils::logError($e, __METHOD__); AppUtils::sendError($e->getCode(), "Error getting forums for user {$userId}", $e->getMessage()); } }