[Flow] Simple Search
Patric Eckhart
mail at patriceckhart.com
Mon Jun 15 18:03:46 CEST 2015
Hey guys,
I would create a simple search action in my controller.
With this code I have tried to search my database, but I get 0 results.
I want to check if $searchstring occurs in one of the fields
$filterArr = array('title' => $searchstring, 'description' => $searchstring, 'fullname' => $searchstring, 'thingcode' => $searchstring);
$classname2 = '\My\Projekt\Domain\Model\Thing';
$query2 = $this->persistenceManager->createQueryForType($classname2);
foreach($filterArr as $property => $filter) {
if(isset($filter)) {
$constraintArr[] = $query2->equals($property, $filter);
}
}
$results2 = $query2->matching($query2->logicalOr($constraintArr))->execute();
while($result2 = $results2->current()){
$results2->next();
}
$this->view->assign('searchresults', $results2);
More information about the Flow
mailing list