public static function appendWhere(QueryBuilder $queryBuilder, DataTablesWrapperInterface $dtWrapper) {

        $operator = static::determineOperator($dtWrapper);
        if (null === $operator) {
            return;
        }

        $wheres = [];
        $params = [];
        $values = [];

        foreach ($dtWrapper->getRequest()->getColumns() as $dtColumn) {

            if (true === $dtColumn->getSearchable() && ("OR" === $operator || "" !== $dtColumn->getSearch()->getValue())) {

                $wheres[] = DataTablesMappingHelper::getWhere($dtColumn->getMapping());
                $params[] = DataTablesMappingHelper::getParam($dtColumn->getMapping());
                $values[] = "%" . ("AND" === $operator ? $dtColumn->getSearch()->getValue() : $dtWrapper->getRequest()->getSearch()->getValue()) . "%";
            }
        }

        $queryBuilder->andWhere("(" . implode(" " . $operator . " ", $wheres) . ")");
        for ($i = count($params) - 1; 0 <= $i; --$i) {
            $queryBuilder->setParameter($params[$i], $values[$i]);
        }
    }
public static function appendWhere(QueryBuilder $queryBuilder, DataTablesWrapperInterface $dtWrapper) {

        $operator = static::determineOperator($dtWrapper);
        if (null === $operator) {
            return;
        }

        $wheres = [];
        $params = [];
        $values = [];

        foreach ($dtWrapper->getRequest()->getColumns() as $dtColumn) {

            if (true === $dtColumn->getSearchable() && ("OR" === $operator || "" !== $dtColumn->getSearch()->getValue())) {

                $wheres[] = DataTablesMappingHelper::getWhere($dtColumn->getMapping());
                $params[] = DataTablesMappingHelper::getParam($dtColumn->getMapping());
                $values[] = "%" . ("AND" === $operator ? $dtColumn->getSearch()->getValue() : $dtWrapper->getRequest()->getSearch()->getValue()) . "%";
            }
        }

        $queryBuilder->andWhere("(" . implode(" " . $operator . " ", $wheres) . ")");
        for ($i = count($params) - 1; 0 <= $i; --$i) {
            $queryBuilder->setParameter($params[$i], $values[$i]);
        }
    }
public static function appendWhere ( QueryBuilder $ queryBuilder , DataTablesWrapperInterface $ dtWrapper ) { $ operator = static :: determineOperator ( $ dtWrapper ) ; if ( null === $ operator ) { return ; } $ wheres = [ ] ; $ params = [ ] ; $ values = [ ] ; foreach ( $ dtWrapper -> getRequest ( ) -> getColumns ( ) as $ dtColumn ) { if ( true === $ dtColumn -> getSearchable ( ) && ( "OR" === $ operator || "" !== $ dtColumn -> getSearch ( ) -> getValue ( ) ) ) { $ wheres [ ] = DataTablesMappingHelper :: getWhere ( $ dtColumn -> getMapping ( ) ) ; $ params [ ] = DataTablesMappingHelper :: getParam ( $ dtColumn -> getMapping ( ) ) ; $ values [ ] = "%" . ( "AND" === $ operator ? $ dtColumn -> getSearch ( ) -> getValue ( ) : $ dtWrapper -> getRequest ( ) -> getSearch ( ) -> getValue ( ) ) . "%" ; } } $ queryBuilder -> andWhere ( "(" . implode ( " " . $ operator . " " , $ wheres ) . ")" ) ; for ( $ i = count ( $ params ) - 1 ; 0 <= $ i ; -- $ i ) { $ queryBuilder -> setParameter ( $ params [ $ i ] , $ values [ $ i ] ) ; } }
Append a WHERE clause.

@param QueryBuilder $queryBuilder The query builder.
@param DataTablesWrapperInterface $dtWrapper The wrapper.
@return void
Append a WHERE clause .