Newscoop\Service\Implementation\AEntityServiceDoctrine::processInterogation PHP Method

processInterogation() protected method

Builds on to the provided query builder the interogations that will reflect the provided search object.
protected processInterogation ( Search $search, Doctrine\ORM\QueryBuilder $qb )
$search Newscoop\Service\Model\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).
$qb Doctrine\ORM\QueryBuilder 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);
                }
            }
        }
    }