lithium\data\source\Database::_processOperator()

protected method

Helper method used by _processConditions.

Parameters

  • string The

    field name string.

  • array The

    operator to parse.

  • array The

    schema of the field.

  • string The

    glue operator (e.g 'AND' or 'OR'.

Returns

mixed

Returns the operator expression string or false if no operator is applicable.

Source

	protected function _processOperator($key, $value, $fieldMeta, $glue) {
		if (!is_string($key) || !is_array($value)) {
			return false;
		}
		$operator = strtoupper(key($value));
		if (!is_numeric($operator)) {
			if (!isset($this->_operators[$operator])) {
				throw new QueryException("Unsupported operator `{$operator}`.");
			}
			foreach ($value as $op => $val) {
				$result[] = $this->_operator($key, [$op => $val], $fieldMeta);
			}
			return '(' . implode(' ' . $glue . ' ', $result) . ')';
		}
		return false;
	}