protected function _conditions(array $conditions, $model, $schema, $context) {
		$ops = $this->_operators;
		$castOpts = [
			'first' => true, 'database' => $this, 'wrap' => false, 'asContent' => true
		];

		$cast = function($key, $value) use (&$schema, &$castOpts) {
			return $schema ? $schema->cast(null, $key, $value, $castOpts) : $value;
		};

		foreach ($conditions as $key => $value) {
			if (in_array($key, $this->_boolean)) {
				$operator = isset($ops[$key]) ? $ops[$key] : $key;

				foreach ($value as $i => $compare) {
					$value[$i] = $this->_conditions($compare, $model, $schema, $context);
				}
				unset($conditions[$key]);
				$conditions[$operator] = $value;
				continue;
			}
			if (is_object($value)) {
				continue;
			}
			if (!is_array($value)) {
				$conditions[$key] = $cast($key, $value);
				continue;
			}
			$current = key($value);

			if (!isset($ops[$current]) && $current[0] !== '$') {
				$conditions[$key] = ['$in' => $cast($key, $value)];
				continue;
			}
			$conditions[$key] = $this->_operators($key, $value, $schema);
		}
		return $conditions;
	}
protected function _conditions(array $conditions, $model, $schema, $context) {
		$ops = $this->_operators;
		$castOpts = [
			'first' => true, 'database' => $this, 'wrap' => false, 'asContent' => true
		];

		$cast = function($key, $value) use (&$schema, &$castOpts) {
			return $schema ? $schema->cast(null, $key, $value, $castOpts) : $value;
		};

		foreach ($conditions as $key => $value) {
			if (in_array($key, $this->_boolean)) {
				$operator = isset($ops[$key]) ? $ops[$key] : $key;

				foreach ($value as $i => $compare) {
					$value[$i] = $this->_conditions($compare, $model, $schema, $context);
				}
				unset($conditions[$key]);
				$conditions[$operator] = $value;
				continue;
			}
			if (is_object($value)) {
				continue;
			}
			if (!is_array($value)) {
				$conditions[$key] = $cast($key, $value);
				continue;
			}
			$current = key($value);

			if (!isset($ops[$current]) && $current[0] !== '$') {
				$conditions[$key] = ['$in' => $cast($key, $value)];
				continue;
			}
			$conditions[$key] = $this->_operators($key, $value, $schema);
		}
		return $conditions;
	}
protected function _conditions ( array $ conditions , $ model , $ schema , $ context ) { $ ops = $ this -> _operators ; $ castOpts = [ 'first' => true , 'database' => $ this , 'wrap' => false , 'asContent' => true ] ; $ cast = function ( $ key , $ value ) use ( & $ schema , & $ castOpts ) { return $ schema ? $ schema -> cast ( null , $ key , $ value , $ castOpts ) : $ value ; } ; foreach ( $ conditions as $ key => $ value ) { if ( in_array ( $ key , $ this -> _boolean ) ) { $ operator = isset ( $ ops [ $ key ] ) ? $ ops [ $ key ] : $ key ; foreach ( $ value as $ i => $ compare ) { $ value [ $ i ] = $ this -> _conditions ( $ compare , $ model , $ schema , $ context ) ; } unset ( $ conditions [ $ key ] ) ; $ conditions [ $ operator ] = $ value ; continue ; } if ( is_object ( $ value ) ) { continue ; } if ( ! is_array ( $ value ) ) { $ conditions [ $ key ] = $ cast ( $ key , $ value ) ; continue ; } $ current = key ( $ value ) ; if ( ! isset ( $ ops [ $ current ] ) && $ current [ 0 ] !== '$' ) { $ conditions [ $ key ] = [ '$in' => $ cast ( $ key , $ value ) ] ; continue ; } $ conditions [ $ key ] = $ this -> _operators ( $ key , $ value , $ schema ) ; } return $ conditions ; }
Protected helper method used to format conditions.

@todo Catch Document/Array objects used in conditions and extract their values.
@param array $conditions The conditions array to be processed.
@param string $model The name of the model class used in the query.
@param object $schema The object containing the schema definition.
@param object $context The `Query` object.
@return array Processed query conditions.
Protected helper method used to format conditions .