/**
* Returns a like criterion used for matching objects against a query.
* Matches if the property named $propertyName is like the $operand, using
* standard SQL wildcards.
*
* @param string $propertyName The name of the property to compare against
* @param string $operand The value to compare with
* @param boolean $caseSensitive Whether the matching should be done case-sensitive
* @return object
* @throws InvalidQueryException if used on a non-string property
* @api
*/
public function like($propertyName, $operand, $caseSensitive = true)
{
if (!is_string($operand)) {
throw new InvalidQueryException('Operand must be a string, was ' . gettype($operand), 1276781107);
}
if ($caseSensitive) {
$comparison = $this->qomFactory->comparison($this->qomFactory->propertyValue($propertyName, '_entity'), QueryInterface::OPERATOR_LIKE, $operand);
} else {
$comparison = $this->qomFactory->comparison($this->qomFactory->lowerCase($this->qomFactory->propertyValue($propertyName, '_entity')), QueryInterface::OPERATOR_LIKE, strtolower($operand));
}
return $comparison;
}