/**
  * Filter the query for list.
  *
  * @returns array
  *   An array of filters to apply.
  *
  * @throws \Drupal\restful\Exception\BadRequestException
  * @throws \Drupal\restful\Exception\UnprocessableEntityException
  *
  * @see \RestfulEntityBase::getQueryForList
  */
 protected function parseRequestForListFilter()
 {
     if (!$this->request->isListRequest($this->getResourcePath())) {
         // Not a list request, so we don't need to filter.
         // We explicitly check this, as this function might be called from a
         // formatter plugin, after RESTful's error handling has finished, and an
         // invalid key might be passed.
         return array();
     }
     $input = $this->getRequest()->getParsedInput();
     if (empty($input['filter'])) {
         // No filtering is needed.
         return array();
     }
     $url_params = empty($this->options['urlParams']) ? array() : $this->options['urlParams'];
     if (isset($url_params['filter']) && !$url_params['filter']) {
         throw new UnprocessableEntityException('Filter parameters have been disabled in server configuration.');
     }
     $filters = array();
     foreach ($input['filter'] as $public_field => $value) {
         if (!static::isNestedField($public_field) && !$this->fieldDefinitions->get($public_field)) {
             throw new BadRequestException(format_string('The filter @filter is not allowed for this path.', array('@filter' => $public_field)));
         }
         $filters[] = static::processFilterInput($value, $public_field);
     }
     return $filters;
 }