Exemplo n.º 1
0
 /**
  * Method to get property SearchHelper
  *
  * @param bool $new
  *
  * @return SearchHelper
  */
 public function getSearchHelper($new = false)
 {
     if (!$this->searchHelper || $new) {
         $this->searchHelper = new SearchHelper();
     }
     $this->searchHelper->fuzzySearching((bool) $this->fuzzySearching());
     return $this->searchHelper;
 }
Exemplo n.º 2
0
 /**
  * Configure the filter handlers.
  *
  * Example:
  * ``` php
  * $filterHelper->setHandler(
  *     'user.date',
  *     function($query, $field, $value)
  *     {
  *         $query->where($field . ' >= ' . $value);
  *     }
  * );
  * ```
  *
  * @param FilterHelperInterface $filterHelper The filter helper object.
  *
  * @return  void
  */
 protected function configureFilters(FilterHelperInterface $filterHelper)
 {
     $filterHelper->setHandler('activation', function (Query $query, $field, $value) {
         if ((string) $value == '0') {
             $query->where('CHAR_LENGTH(user.activation) > 0');
         } elseif ($value == 1) {
             $query->where('CHAR_LENGTH(user.activation) = 0');
         }
     });
 }