/**
* Builds on to the provided query builder the interogations that will reflect the provided search object.
*
* @param Search $search
* The search from which the query is build, if the search does not reflect any interogation
* no actions needs to be taken, *(not null not empty).
*
* @param QueryBuilder $qb
* The Doctrine query builder to be constructed on, *(not null not empty).
*/
protected function processInterogation(Search $search, QueryBuilder $qb)
{
foreach ($search->getAllColumns() as $column) {
/** @var $column Newscoop\Service\Model\Search\ColumnOrderLike */
if ($column instanceof ColumnOrderLike) {
$like = $column->getLike();
if (!empty($like)) {
$name = $this->map($search, $column);
$field = self::ALIAS . '.' . $name;
$qb->andWhere($field . ' like :' . $name);
$qb->setParameter($name, $like);
}
}
}
}