protected function addFilters($qb, $filters)
    {
        $list = [];

        $sgbd = isset($this->app['dbms']) ? $this->app['dbms'] : 'mysql';

        foreach ($filters as $key => $filter) {
            $filterKey = str_replace('.','_',$key);

            if (is_array($filter)) {
                $key = $filter['property'];
                $filter = $filter['clause'];
            }

            if (strpos($key, '.') === false) {
                $keyAlias = "t.".$key;
            } else {
                $keyAlias = $key;
                $key = str_replace('.','_',$key);
            }

            $params = explode(':',$filter);

            if (count($params) == 1) {
                if (!in_array($filter, array('isnull','isnotnull','in','notin'))) {
                    array_unshift($params, '=');
                }

                if (in_array($filter, array('isnull','isnotnull'))) {
                    array_unshift($params, $filter);
                }
            }

            $filter = $params[1];

            switch ($params[0]) {
                case '%':
                    $list[$filterKey] = "%$filter%";

                    if ($sgbd == 'postgres'){
                        $qb->andWhere($keyAlias.' ilike :'.$filterKey);
                    } else {
                        $qb->andWhere($keyAlias.' like :'.$filterKey);
                    }

                    break;
                case 'in':
                    $qb->andWhere($keyAlias.' IN ('.$filter.')');
                    break;
                case 'notin':
                    $qb->andWhere($keyAlias.' NOT IN ('.$filter.')');
                    break;
                case 'isnull':
                    $qb->andWhere($keyAlias.'  IS NULL');
                    break;
                case 'isnotnull':
                    $qb->andWhere($keyAlias.'  IS NOT NULL');
                    break;
                default:
                    $list[$filterKey] = $filter;
                    $qb->andWhere($keyAlias.' '.$params[0].' :'.$filterKey);
                    break;
            }


        }

        return $list;
    }
protected function addFilters($qb, $filters)
    {
        $list = [];

        $sgbd = isset($this->app['dbms']) ? $this->app['dbms'] : 'mysql';

        foreach ($filters as $key => $filter) {
            $filterKey = str_replace('.','_',$key);

            if (is_array($filter)) {
                $key = $filter['property'];
                $filter = $filter['clause'];
            }

            if (strpos($key, '.') === false) {
                $keyAlias = "t.".$key;
            } else {
                $keyAlias = $key;
                $key = str_replace('.','_',$key);
            }

            $params = explode(':',$filter);

            if (count($params) == 1) {
                if (!in_array($filter, array('isnull','isnotnull','in','notin'))) {
                    array_unshift($params, '=');
                }

                if (in_array($filter, array('isnull','isnotnull'))) {
                    array_unshift($params, $filter);
                }
            }

            $filter = $params[1];

            switch ($params[0]) {
                case '%':
                    $list[$filterKey] = "%$filter%";

                    if ($sgbd == 'postgres'){
                        $qb->andWhere($keyAlias.' ilike :'.$filterKey);
                    } else {
                        $qb->andWhere($keyAlias.' like :'.$filterKey);
                    }

                    break;
                case 'in':
                    $qb->andWhere($keyAlias.' IN ('.$filter.')');
                    break;
                case 'notin':
                    $qb->andWhere($keyAlias.' NOT IN ('.$filter.')');
                    break;
                case 'isnull':
                    $qb->andWhere($keyAlias.'  IS NULL');
                    break;
                case 'isnotnull':
                    $qb->andWhere($keyAlias.'  IS NOT NULL');
                    break;
                default:
                    $list[$filterKey] = $filter;
                    $qb->andWhere($keyAlias.' '.$params[0].' :'.$filterKey);
                    break;
            }


        }

        return $list;
    }
protected function addFilters ( $ qb , $ filters ) { $ list = [ ] ; $ sgbd = isset ( $ this -> app [ 'dbms' ] ) ? $ this -> app [ 'dbms' ] : 'mysql' ; foreach ( $ filters as $ key => $ filter ) { $ filterKey = str_replace ( '.' , '_' , $ key ) ; if ( is_array ( $ filter ) ) { $ key = $ filter [ 'property' ] ; $ filter = $ filter [ 'clause' ] ; } if ( strpos ( $ key , '.' ) === false ) { $ keyAlias = "t." . $ key ; } else { $ keyAlias = $ key ; $ key = str_replace ( '.' , '_' , $ key ) ; } $ params = explode ( ':' , $ filter ) ; if ( count ( $ params ) == 1 ) { if ( ! in_array ( $ filter , array ( 'isnull' , 'isnotnull' , 'in' , 'notin' ) ) ) { array_unshift ( $ params , '=' ) ; } if ( in_array ( $ filter , array ( 'isnull' , 'isnotnull' ) ) ) { array_unshift ( $ params , $ filter ) ; } } $ filter = $ params [ 1 ] ; switch ( $ params [ 0 ] ) { case '%' : $ list [ $ filterKey ] = "%$filter%" ; if ( $ sgbd == 'postgres' ) { $ qb -> andWhere ( $ keyAlias . ' ilike :' . $ filterKey ) ; } else { $ qb -> andWhere ( $ keyAlias . ' like :' . $ filterKey ) ; } break ; case 'in' : $ qb -> andWhere ( $ keyAlias . ' IN (' . $ filter . ')' ) ; break ; case 'notin' : $ qb -> andWhere ( $ keyAlias . ' NOT IN (' . $ filter . ')' ) ; break ; case 'isnull' : $ qb -> andWhere ( $ keyAlias . '  IS NULL' ) ; break ; case 'isnotnull' : $ qb -> andWhere ( $ keyAlias . '  IS NOT NULL' ) ; break ; default : $ list [ $ filterKey ] = $ filter ; $ qb -> andWhere ( $ keyAlias . ' ' . $ params [ 0 ] . ' :' . $ filterKey ) ; break ; } } return $ list ; }
Adiciona os filtros ao query builder.

@param QueryBuilder $qb
@param array $filters

@return array
Adiciona os filtros ao query builder .