You are here

protected static function RestfulBase::isValidConjunctionForFilter in RESTful 7

Check if a conjunction is valid for filtering.

Parameters

string $conjunction: The operator.

Throws

RestfulBadRequestException

1 call to RestfulBase::isValidConjunctionForFilter()
RestfulBase::parseRequestForListFilter in plugins/restful/RestfulBase.php
Filter the query for list.
2 methods override RestfulBase::isValidConjunctionForFilter()
RestfulDataProviderCToolsPlugins::isValidConjunctionForFilter in plugins/restful/RestfulDataProviderCToolsPlugins.php
Overrides \RestfulBase::isValidConjuctionForFilter().
RestfulDataProviderEFQ::isValidConjunctionForFilter in plugins/restful/RestfulDataProviderEFQ.php
Overrides \RestfulBase::isValidConjuctionForFilter().

File

plugins/restful/RestfulBase.php, line 1087
Contains RestfulBase.

Class

RestfulBase
Class \RestfulBase

Code

protected static function isValidConjunctionForFilter($conjunction) {
  $allowed_conjunctions = array(
    'AND',
    'OR',
    'XOR',
  );
  if (!in_array(strtoupper($conjunction), $allowed_conjunctions)) {
    throw new \RestfulBadRequestException(format_string('Conjunction "@conjunction" is not allowed for filtering on this resource. Allowed conjunctions are: !allowed', array(
      '@conjunction' => $conjunction,
      '!allowed' => implode(', ', $allowed_conjunctions),
    )));
  }
}