/** * Returns all info from the Gems surveys table for a givens Gems Survey Id * * Uses internal caching to prevent multiple db lookups during a program run (so no caching * beyond page generation time) * * @param int $surveyId * @param string $field Optional field to retrieve data for * @return array */ protected function getSurveyData($surveyId, $field = null) { static $cache = array(); if (!isset($cache[$surveyId])) { $cache[$surveyId] = $this->_gemsDb->fetchRow('SELECT * FROM gems__surveys WHERE gsu_id_survey = ? LIMIT 1', $surveyId, \Zend_Db::FETCH_ASSOC); } if (null === $field) { return $cache[$surveyId]; } else { if (isset($cache[$surveyId][$field])) { return $cache[$surveyId][$field]; } } }