* @license http://github.com/basdenooijer/solarium/raw/master/COPYING * @link http://www.solarium-project.org/ * * @package Solarium * @subpackage Result */ /** * QueryType result * * @package Solarium * @subpackage Result */ class Solarium_Result_QueryType extends Solarium_Result { /** * Lazy load parsing indicator * * @var bool */ protected $_parsed = false; /** * Parse response into result objects * * Only runs once * * @return void */ protected function _parseResponse() { if (!$this->_parsed) { $queryType = $this->_query->getType(); $queryTypes = $this->_client->getQueryTypes(); if (!isset($queryTypes[$queryType])) { throw new Solarium_Exception('No responseparser registered for querytype: '. $queryType); } $responseParserClass = $queryTypes[$queryType]['responseparser']; $responseParser = new $responseParserClass; $this->_mapData($responseParser->parse($this)); $this->_parsed = true; } } /** * Map parser data into properties * * @param array $mapData * @return void */ protected function _mapData($mapData) { foreach ($mapData AS $key => $data) { $this->{'_'.$key} = $data; } } }