Source

						protected function _conditions($conditions, $model, $schema, $context) {
		$castOpts = compact('schema') + array('first' => true, 'arrays' => false);

		foreach ($conditions as $key => $value) {
			if ($key === '$or' || $key === 'or' || $key === '||') {
				foreach ($value as $i => $or) {
					$value[$i] = $this->_conditions($or, $model, $schema, $context);
				}
				unset($conditions[$key]);
				$conditions['$or'] = $value;
				continue;
			}
			if (is_object($value)) {
				continue;
			}
			if (!is_array($value)) {
				$conditions[$key] = $this->cast(null, array($key => $value), $castOpts);
				continue;
			}
			$current = key($value);
			$isOpArray = (isset($this->_operators[$current]) || $current[0] === '$');

			if (!$isOpArray) {
				$data = array($key => $value);
				$conditions[$key] = array('$in' => $this->cast($model, $data, $castOpts));
				continue;
			}
			$operations = array();

			foreach ($value as $op => $val) {
				if (is_object($result = $this->_operator($model, $key, $op, $val, $schema))) {
					$operations = $result;
					break;
				}
				$operations += $this->_operator($model, $key, $op, $val, $schema);
			}
			$conditions[$key] = $operations;
		}
		return $conditions;
	}