. */ /** * ConditionalTerm = ConditionalFactor {"AND" ConditionalFactor} * * @package Doctrine * @subpackage Query * @author Guilherme Blanco * @author Janne Vanhala * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://www.phpdoctrine.org * @since 1.0 * @version $Revision$ */ class Doctrine_Query_Production_ConditionalTerm extends Doctrine_Query_Production { protected $_conditionalFactors = array(); public function syntax($paramHolder) { // ConditionalTerm = ConditionalFactor {"AND" ConditionalFactor} $this->_conditionalFactors[] = $this->AST('ConditionalFactor', $paramHolder); while ($this->_isNextToken(Doctrine_Query_Token::T_AND)) { $this->_parser->match(Doctrine_Query_Token::T_AND); $this->_conditionalFactors[] = $this->AST('ConditionalFactor', $paramHolder); } // Optimize depth instances in AST if (count($this->_conditionalFactors) == 1) { return $this->_conditionalFactors[0]; } } public function buildSql() { return implode(' AND ', $this->_mapConditionalFactors()); } protected function _mapConditionalFactors() { return array_map(array(&$this, '_mapConditionalFactor'), $this->_conditionalFactors); } protected function _mapConditionalFactor($value) { return $value->buildSql(); } }