public function test2Action(Context $context, $param1, $param2) { $mysession1 = $context->getSession('MySession1'); error_log('[testAction2]##########################MySession1: ' . var_export($mysession1, true)); $this->setVirtualAreaId(1); $db = \Unicorn\Database\DatabaseManager::getAreaConnection(); $result = $db->fetchRow('select id,content from b_system_t where b_id = 20000'); error_log('################' . var_export($result, true)); $this->setOutput('result', array('a' => $param1, 'b' => $param2)); return Constants::SYS_SUCCESS; }
/** * Set Virtual Area Id * * @param int $vaId */ public function setVirtualAreaId($vaId) { DatabaseManager::setVirtualAreaId($vaId); }
/** * Get virtual area slave connection. * * @return Database * @throws \Unicorn\Exception\DatabaseException */ public function getSlaveConnection() { return DatabaseManager::getAreaConnection(false); }