Model/Datasource/ArraySource.php
protected function _pseudoSelect(Model $model, &$queryData) {
		$out = '(symbolic) SELECT ';
		if (empty($queryData['fields'])) {
			$out .= '*';
		} elseif ($queryData['fields']) {
			$out .= 'COUNT(*)';
		} else {
			$out .= implode(', ', $queryData['fields']);
		}
		$out .= ' FROM ' . $model->alias;
		if (!empty($queryData['conditions'])) {
			$out .= ' WHERE';
			foreach ($queryData['conditions'] as $id => $condition) {
				if (empty($condition)) {
					continue;
				}
				if (is_array($condition)) {
					$condition = '(' . implode(', ', $condition) . ')';
					if (strpos($id, ' ') === false) {
						$id .= ' IN';
					}
				}
				if (is_string($id)) {
					if (strpos($id, ' ') !== false) {
						$condition = $id . ' ' . $condition;
					} else {
						$condition = $id . ' = ' . $condition;
					}
				}
				if (preg_match('/^(\w+\.)?\w+ /', $condition, $matches)) {
					if (!empty($matches[1]) && substr($matches[1], 0, -1) !== $model->alias) {
						continue;
					}
				}
				$out .= ' (' . $condition . ') &&';
			}
			$out = substr($out, 0, -3);
		}
		if (!empty($queryData['order'][0])) {
			$out .= ' ORDER BY ' . implode(', ', $queryData['order']);
		}
		if (!empty($queryData['limit'])) {
			$out .= ' LIMIT ' . (($queryData['page'] - 1) * $queryData['limit']) . ', ' . $queryData['limit'];
		}
		return $out;
	}
protected function _pseudoSelect(Model $model, &$queryData) {
		$out = '(symbolic) SELECT ';
		if (empty($queryData['fields'])) {
			$out .= '*';
		} elseif ($queryData['fields']) {
			$out .= 'COUNT(*)';
		} else {
			$out .= implode(', ', $queryData['fields']);
		}
		$out .= ' FROM ' . $model->alias;
		if (!empty($queryData['conditions'])) {
			$out .= ' WHERE';
			foreach ($queryData['conditions'] as $id => $condition) {
				if (empty($condition)) {
					continue;
				}
				if (is_array($condition)) {
					$condition = '(' . implode(', ', $condition) . ')';
					if (strpos($id, ' ') === false) {
						$id .= ' IN';
					}
				}
				if (is_string($id)) {
					if (strpos($id, ' ') !== false) {
						$condition = $id . ' ' . $condition;
					} else {
						$condition = $id . ' = ' . $condition;
					}
				}
				if (preg_match('/^(\w+\.)?\w+ /', $condition, $matches)) {
					if (!empty($matches[1]) && substr($matches[1], 0, -1) !== $model->alias) {
						continue;
					}
				}
				$out .= ' (' . $condition . ') &&';
			}
			$out = substr($out, 0, -3);
		}
		if (!empty($queryData['order'][0])) {
			$out .= ' ORDER BY ' . implode(', ', $queryData['order']);
		}
		if (!empty($queryData['limit'])) {
			$out .= ' LIMIT ' . (($queryData['page'] - 1) * $queryData['limit']) . ', ' . $queryData['limit'];
		}
		return $out;
	}
protected function _pseudoSelect ( Model $ model , & $ queryData ) { $ out = '(symbolic) SELECT ' ; if ( empty ( $ queryData [ 'fields' ] ) ) { $ out .= '*' ; } elseif ( $ queryData [ 'fields' ] ) { $ out .= 'COUNT(*)' ; } else { $ out .= implode ( ', ' , $ queryData [ 'fields' ] ) ; } $ out .= ' FROM ' . $ model -> alias ; if ( ! empty ( $ queryData [ 'conditions' ] ) ) { $ out .= ' WHERE' ; foreach ( $ queryData [ 'conditions' ] as $ id => $ condition ) { if ( empty ( $ condition ) ) { continue ; } if ( is_array ( $ condition ) ) { $ condition = '(' . implode ( ', ' , $ condition ) . ')' ; if ( strpos ( $ id , ' ' ) === false ) { $ id .= ' IN' ; } } if ( is_string ( $ id ) ) { if ( strpos ( $ id , ' ' ) !== false ) { $ condition = $ id . ' ' . $ condition ; } else { $ condition = $ id . ' = ' . $ condition ; } } if ( preg_match ( '/^(\w+\.)?\w+ /' , $ condition , $ matches ) ) { if ( ! empty ( $ matches [ 1 ] ) && substr ( $ matches [ 1 ] , 0 , - 1 ) !== $ model -> alias ) { continue ; } } $ out .= ' (' . $ condition . ') &&' ; } $ out = substr ( $ out , 0 , - 3 ) ; } if ( ! empty ( $ queryData [ 'order' ] [ 0 ] ) ) { $ out .= ' ORDER BY ' . implode ( ', ' , $ queryData [ 'order' ] ) ; } if ( ! empty ( $ queryData [ 'limit' ] ) ) { $ out .= ' LIMIT ' . ( ( $ queryData [ 'page' ] - 1 ) * $ queryData [ 'limit' ] ) . ', ' . $ queryData [ 'limit' ] ; } return $ out ; }
Generate a pseudo select to log

@param object $model Model
@param array $queryData Query data sended by find
@return string Pseudo query
Generate a pseudo select to log