private function makeComparison($builder, $field, $operator, $value, $pcount = NULL)
	{
		$method_translations = [
			'='   => 'eq',
			'<'   => 'lt',
			'>'   => 'gt',
			'!'   => 'neq',
			'~'   => 'like',
			'in'  => 'in',
			'!in' => 'notIn',
			'=='  => 'eq',
			'!='  => 'neq',
			'<>'  => 'neq',
			'<='  => 'lte',
			'>='  => 'gte'
		];

		if (!isset($method_translations[$operator])) {
			throw new InvalidArgumentException(
				'Build terms contains invalid operator ' . $operator
			);
		}

		$method = $method_translations[$operator];

		if (is_null($value)) {
			switch ($method) {
				case 'eq':
					$method = 'isNull';
					break;

				case 'neq':
					$method = 'isNotNull';
					break;
			}

		} elseif (is_array($value)) {
			switch ($method) {
				case 'eq':
					$method = 'in';
					break;

				case 'neq':
					$method = 'notIn';
					break;
			}
		}

		if ($method == 'like') {
			$field = 'LOWER(' . $field . ')';
		}

		return ($pcount !== NULL)
			? $builder->expr()->$method($field, '?' . $pcount)
			: $builder->expr()->$method($field);
	}