/** * Update user issues * * @return void */ public function updateIssues() { $users = $this->_chat->getCollection()->loadAll($this->_chat)->getData(); foreach ($users as $user) { $this->_issueHandler->setUserData($user)->handleUserIssues(); } }
/** * Add subscriber * * @param array $update Update * @param number $keyId Redmine key ID * * @return array */ protected function _addSubscriber(array $update, $keyId = null) { $chatData = []; if (!$keyId) { return $chatData; } $chatData = [Chat::COLUMN_CHAT_ID => $this->_updateHelper->getChatId($update), Chat::COLUMN_CHAT_NAME => $this->_updateHelper->getChatName($update), Chat::COLUMN_REDMINE_KEY_ID => $keyId]; $this->_chat->setData($chatData)->save(); return $chatData; }
/** * Delete subscriber * * @param array $update Update * * @return array */ protected function _deleteSubscriber(array $update) { $chatId = $this->_updateHelper->getChatId($update); $chatName = $this->_updateHelper->getChatName($update); $chatData = [Chat::COLUMN_CHAT_ID => $chatId, Chat::COLUMN_CHAT_NAME => $chatName]; $chat = $this->_chat->setId($chatId)->load(); if ($chat) { $this->_chat->delete(); $chatData['success'] = true; $chatData[Chat::COLUMN_REDMINE_KEY_ID] = $chat[Chat::COLUMN_REDMINE_KEY_ID]; } else { $chatData['success'] = false; } return $chatData; }