/**
  * Validate search
  * 
  * @param RequestInterface $request
  * @param array            $errors
  */
 protected function validateSearch(RequestInterface $request, array &$errors)
 {
     foreach ($request->getSearch() as $field => $value) {
         if (!$this->schema->hasField($field)) {
             $errors[] = sprintf('Search cannot be applied to non-existent field "%s"', $field);
             continue;
         }
         if (!$this->schema->getField($field)->isSearchable()) {
             $errors[] = sprintf('Field "%s" is not searchable', $field);
         }
         if (empty($value)) {
             $errors[] = sprintf('Search string of field "%s" is empty', $value, $field);
         }
     }
 }
 /**
  * Add fields by properties without "Exclude" annotation
  */
 protected function addFieldsByExcludeStrategy()
 {
     $properties = $this->getClassReflection()->getProperties();
     $excludedAnnotations = $this->getExcludeAnnotations();
     $columnsAnnotations = $this->getColumnAnnotations();
     foreach ($properties as $property) {
         $name = $property->getName();
         if (isset($excludedAnnotations[$name])) {
             continue;
         }
         $field = new Field($name);
         if (isset($columnsAnnotations[$name])) {
             $this->applyAnnotation($field, $columnsAnnotations[$name]);
         }
         $this->schema->addField($field);
     }
 }