You are here

protected static function RestfulDataProviderEFQ::isValidOperatorsForFilter in RESTful 7

Overrides \RestfulBase::isValidOperatorsForFilter().

Overrides RestfulBase::isValidOperatorsForFilter

File

plugins/restful/RestfulDataProviderEFQ.php, line 238
Contains \RestfulDataProviderEFQ

Class

RestfulDataProviderEFQ
@file Contains \RestfulDataProviderEFQ

Code

protected static function isValidOperatorsForFilter(array $operators) {
  $allowed_operators = array(
    '=',
    '>',
    '<',
    '>=',
    '<=',
    '<>',
    '!=',
    'BETWEEN',
    'CONTAINS',
    'IN',
    'LIKE',
    'NOT IN',
    'STARTS_WITH',
  );
  foreach ($operators as $operator) {
    if (!in_array($operator, $allowed_operators)) {
      throw new \RestfulBadRequestException(format_string('Operator "@operator" is not allowed for filtering on this resource. Allowed operators are: !allowed', array(
        '@operator' => $operator,
        '!allowed' => implode(', ', $allowed_operators),
      )));
    }
  }
}