* @license http://github.com/basdenooijer/solarium/raw/master/COPYING * @link http://www.solarium-project.org/ * * @package Solarium * @subpackage Query */ /** * Base class for all query types, not intended for direct usage * * @package Solarium * @subpackage Query */ abstract class Solarium_Query extends Solarium_Configurable { /** * Helper instance * * @var Solarium_Query_Helper */ protected $_helper; /** * Extra query params (e.g. dereferenced params) * * @var array */ protected $_params = array(); /** * Get type for this query * * @return string */ abstract public function getType(); /** * Set handler option * * @param string $handler * @return Solarium_Query Provides fluent interface */ public function setHandler($handler) { return $this->_setOption('handler', $handler); } /** * Get handler option * * @return string */ public function getHandler() { return $this->getOption('handler'); } /** * Set resultclass option * * If you set a custom result class it must be available through autoloading * or a manual require before calling this method. This is your * responsibility. * * Also you need to make sure it extends the orginal result class of the * query or has an identical API. * * @param string $classname * @return Solarium_Query Provides fluent interface */ public function setResultClass($classname) { return $this->_setOption('resultclass', $classname); } /** * Get resultclass option * * @return string */ public function getResultClass() { return $this->getOption('resultclass'); } /** * Get a helper instance * * Uses lazy loading: the helper is instantiated on first use * * @return Solarium_Query_Helper */ public function getHelper() { if (null === $this->_helper) { $this->_helper = new Solarium_Query_Helper($this); } return $this->_helper; } /** * Add extra params to the request * * Only intended for internal use, for instance with dereferenced params. * Therefore the params are limited in functionality. Only add and get * * @param string $name * @param string $value * @return self Provides fluent interface */ public function addParam($name, $value) { $this->_params[$name] = $value; return $this; } /** * Get extra params * * @return array */ public function getParams() { return $this->_params; } }