Ejemplo n.º 1
0
 /**
  * Filters keyword fields by keywords (including username, email and attributes).
  *
  * @param $keywords
  */
 public function filterByKeywords($keywords)
 {
     $expressions = [$this->query->expr()->like('u.uName', ':keywords'), $this->query->expr()->like('u.uEmail', ':keywords')];
     $keys = \Concrete\Core\Attribute\Key\UserKey::getSearchableIndexedList();
     foreach ($keys as $ak) {
         $cnt = $ak->getController();
         $expressions[] = $cnt->searchKeywords($keywords, $this->query);
     }
     $expr = $this->query->expr();
     $this->query->andWhere(call_user_func_array([$expr, 'orX'], $expressions));
     $this->query->setParameter('keywords', '%' . $keywords . '%');
 }