Exemplo n.º 1
0
 /**
  * @param Combine $combine
  * @param string $value
  * @return string
  * @SuppressWarnings(PHPMD.NPathComplexity)
  */
 protected function _getMappedSqlCombination(Combine $combine, $value = '')
 {
     $out = !empty($value) ? $value : '';
     $value = $combine->getValue() ? '' : ' NOT ';
     $getAggregator = $combine->getAggregator();
     $conditions = $combine->getConditions();
     foreach ($conditions as $key => $condition) {
         /** @var $condition AbstractCondition|Combine */
         $con = $getAggregator == 'any' ? \Zend_Db_Select::SQL_OR : \Zend_Db_Select::SQL_AND;
         $con = isset($conditions[$key + 1]) ? $con : '';
         if ($condition instanceof Combine) {
             $out .= $this->_getMappedSqlCombination($condition, $value);
         } else {
             $out .= $this->_getMappedSqlCondition($condition, $value);
         }
         $out .= $out ? ' ' . $con : '';
     }
     return $this->_expressionFactory->create(['expression' => $out]);
 }