Esempio n. 1
0
 public function executeSearch(sfWebRequest $request)
 {
     $terms = explode(' ', $request->GetParameter('search_terms', ''));
     if (array_count_values($terms) > 0) {
         $query = Doctrine::getTable('Person')->createQuery('a');
         foreach ($terms as $term) {
             if ($term != '') {
                 $query = $query->orWhere("internal_id LIKE ?", '%' . $term . '%');
                 $query = $query->orWhere("identification LIKE ?", '%' . $term . '%');
                 $query = $query->orWhere("first_name LIKE ?", '%' . $term . '%');
                 $query = $query->orWhere("last_name LIKE ?", '%' . $term . '%');
             }
         }
         $this->searchTerms = implode(' ', $terms);
         $this->persons = $query->execute();
     }
 }