lib/db/cortex.php
protected function _sql_mergeRelCondition($cond, $table, &$filter, &$options, $glue='AND') {
		if (!empty($cond[0])) {
			$whereClause = '('.array_shift($cond[0]).')';
			$whereClause = $this->queryParser->sql_prependTableToFields($whereClause,$table);
			if (!$filter)
				$filter = array($whereClause);
			elseif (!empty($filter[0]))
				$filter[0] = '('.$this->queryParser->sql_prependTableToFields($filter[0],$this->table)
					.') '.$glue.' '.$whereClause;
			$filter = array_merge($filter, $cond[0]);
		}
		if ($cond[1] && isset($cond[1]['group'])) {
			$hasGroup = preg_replace('/(\w+)/i', $table.'.$1', $cond[1]['group']);
			$options['group'] .= ','.$hasGroup;
		}
	}
protected function _sql_mergeRelCondition($cond, $table, &$filter, &$options, $glue='AND') {
		if (!empty($cond[0])) {
			$whereClause = '('.array_shift($cond[0]).')';
			$whereClause = $this->queryParser->sql_prependTableToFields($whereClause,$table);
			if (!$filter)
				$filter = array($whereClause);
			elseif (!empty($filter[0]))
				$filter[0] = '('.$this->queryParser->sql_prependTableToFields($filter[0],$this->table)
					.') '.$glue.' '.$whereClause;
			$filter = array_merge($filter, $cond[0]);
		}
		if ($cond[1] && isset($cond[1]['group'])) {
			$hasGroup = preg_replace('/(\w+)/i', $table.'.$1', $cond[1]['group']);
			$options['group'] .= ','.$hasGroup;
		}
	}
protected function _sql_mergeRelCondition ( $ cond , $ table , & $ filter , & $ options , $ glue = 'AND' ) { if ( ! empty ( $ cond [ 0 ] ) ) { $ whereClause = '(' . array_shift ( $ cond [ 0 ] ) . ')' ; $ whereClause = $ this -> queryParser -> sql_prependTableToFields ( $ whereClause , $ table ) ; if ( ! $ filter ) $ filter = array ( $ whereClause ) ; elseif ( ! empty ( $ filter [ 0 ] ) ) $ filter [ 0 ] = '(' . $ this -> queryParser -> sql_prependTableToFields ( $ filter [ 0 ] , $ this -> table ) . ') ' . $ glue . ' ' . $ whereClause ; $ filter = array_merge ( $ filter , $ cond [ 0 ] ) ; } if ( $ cond [ 1 ] && isset ( $ cond [ 1 ] [ 'group' ] ) ) { $ hasGroup = preg_replace ( '/(\w+)/i' , $ table . '.$1' , $ cond [ 1 ] [ 'group' ] ) ; $ options [ 'group' ] .= ',' . $ hasGroup ; } }
merge condition of relation with current condition
@param array $cond condition of related model
@param string $table table of related model
@param array $filter current filter to merge with
@param array $options current options to merge with
@param string $glue
merge condition of relation with current condition