protected function initFilters($query)
    {
        if ($value = $this->getParamAdapter()->getValueOfFilter('name')) {
            $query->where($query->expr()->like('q.name', '?1'))->setParameter('1', '%' . $value . '%');
        }

        if ($value = $this->getParamAdapter()->getValueOfFilter('surname')) {
            $query->where($query->expr()->like('q.surname', '?1'))->setParameter('1', '%' . $value . '%');
        }

        if ($value = $this->getParamAdapter()->getValueOfFilter('doctrine')) {
            $query->where("q.name like '%".$value."%' OR q.surname like '%".$value."%' ");
            $expr = $query->expr();
            $query->where($expr->orX($expr->like('q.name', '?1'), $expr->like('q.surname', '?2')))
                ->setParameter('1', '%' . $value . '%')
                ->setParameter('2', '%' . $value . '%');
        }

        if ($value = $this->getParamAdapter()->getValueOfFilter('street')) {
            $query->where($query->expr()->like('q.street', '?1'))->setParameter('1', '%' . $value . '%');
        }

        if ($value = $this->getParamAdapter()->getValueOfFilter('city')) {
            $query->where($query->expr()->like('q.city', '?1'))->setParameter('1', '%' . $value . '%');
        }

        if ($value = $this->getParamAdapter()->getValueOfFilter('product')) {
            $query->where($query->expr()->like('q.product', '?1'))->setParameter('1', '%' . $value . '%');
        }
    }
protected function initFilters($query)
    {
        if ($value = $this->getParamAdapter()->getValueOfFilter('name')) {
            $query->where($query->expr()->like('q.name', '?1'))->setParameter('1', '%' . $value . '%');
        }

        if ($value = $this->getParamAdapter()->getValueOfFilter('surname')) {
            $query->where($query->expr()->like('q.surname', '?1'))->setParameter('1', '%' . $value . '%');
        }

        if ($value = $this->getParamAdapter()->getValueOfFilter('doctrine')) {
            $query->where("q.name like '%".$value."%' OR q.surname like '%".$value."%' ");
            $expr = $query->expr();
            $query->where($expr->orX($expr->like('q.name', '?1'), $expr->like('q.surname', '?2')))
                ->setParameter('1', '%' . $value . '%')
                ->setParameter('2', '%' . $value . '%');
        }

        if ($value = $this->getParamAdapter()->getValueOfFilter('street')) {
            $query->where($query->expr()->like('q.street', '?1'))->setParameter('1', '%' . $value . '%');
        }

        if ($value = $this->getParamAdapter()->getValueOfFilter('city')) {
            $query->where($query->expr()->like('q.city', '?1'))->setParameter('1', '%' . $value . '%');
        }

        if ($value = $this->getParamAdapter()->getValueOfFilter('product')) {
            $query->where($query->expr()->like('q.product', '?1'))->setParameter('1', '%' . $value . '%');
        }
    }
protected function initFilters ( $ query ) { if ( $ value = $ this -> getParamAdapter ( ) -> getValueOfFilter ( 'name' ) ) { $ query -> where ( $ query -> expr ( ) -> like ( 'q.name' , '?1' ) ) -> setParameter ( '1' , '%' . $ value . '%' ) ; } if ( $ value = $ this -> getParamAdapter ( ) -> getValueOfFilter ( 'surname' ) ) { $ query -> where ( $ query -> expr ( ) -> like ( 'q.surname' , '?1' ) ) -> setParameter ( '1' , '%' . $ value . '%' ) ; } if ( $ value = $ this -> getParamAdapter ( ) -> getValueOfFilter ( 'doctrine' ) ) { $ query -> where ( "q.name like '%" . $ value . "%' OR q.surname like '%" . $ value . "%' " ) ; $ expr = $ query -> expr ( ) ; $ query -> where ( $ expr -> orX ( $ expr -> like ( 'q.name' , '?1' ) , $ expr -> like ( 'q.surname' , '?2' ) ) ) -> setParameter ( '1' , '%' . $ value . '%' ) -> setParameter ( '2' , '%' . $ value . '%' ) ; } if ( $ value = $ this -> getParamAdapter ( ) -> getValueOfFilter ( 'street' ) ) { $ query -> where ( $ query -> expr ( ) -> like ( 'q.street' , '?1' ) ) -> setParameter ( '1' , '%' . $ value . '%' ) ; } if ( $ value = $ this -> getParamAdapter ( ) -> getValueOfFilter ( 'city' ) ) { $ query -> where ( $ query -> expr ( ) -> like ( 'q.city' , '?1' ) ) -> setParameter ( '1' , '%' . $ value . '%' ) ; } if ( $ value = $ this -> getParamAdapter ( ) -> getValueOfFilter ( 'product' ) ) { $ query -> where ( $ query -> expr ( ) -> like ( 'q.product' , '?1' ) ) -> setParameter ( '1' , '%' . $ value . '%' ) ; } }
The filters could also be done with a parametrised query
The filters could also be done with a parametrised query