protected function findWithCriteria(array $criteria, array $orderBy = null, $limit = null, $offset = null)
    {
        $qb = $this->getLoadQuery();
        foreach ($criteria as $col => $val) {
            if (is_array($val)) {
                $qb->andWhere($this->getAlias() . ".$col IN(:$col)");
                $qb->setParameter(":$col", $val, Connection::PARAM_INT_ARRAY);
            } else {
                $qb->andWhere($this->getAlias() . ".$col = :$col");
                $qb->setParameter(":$col", $val);
            }
        }
        if ($orderBy) {
            $qb->orderBy($orderBy[0], $orderBy[1]);
        }
        if ($limit) {
            $qb->setMaxResults($limit);
        }
        if ($offset) {
            $qb->setFirstResult($offset);
        }

        return $qb;
    }
protected function findWithCriteria(array $criteria, array $orderBy = null, $limit = null, $offset = null)
    {
        $qb = $this->getLoadQuery();
        foreach ($criteria as $col => $val) {
            if (is_array($val)) {
                $qb->andWhere($this->getAlias() . ".$col IN(:$col)");
                $qb->setParameter(":$col", $val, Connection::PARAM_INT_ARRAY);
            } else {
                $qb->andWhere($this->getAlias() . ".$col = :$col");
                $qb->setParameter(":$col", $val);
            }
        }
        if ($orderBy) {
            $qb->orderBy($orderBy[0], $orderBy[1]);
        }
        if ($limit) {
            $qb->setMaxResults($limit);
        }
        if ($offset) {
            $qb->setFirstResult($offset);
        }

        return $qb;
    }
protected function findWithCriteria ( array $ criteria , array $ orderBy = null , $ limit = null , $ offset = null ) { $ qb = $ this -> getLoadQuery ( ) ; foreach ( $ criteria as $ col => $ val ) { if ( is_array ( $ val ) ) { $ qb -> andWhere ( $ this -> getAlias ( ) . ".$col IN(:$col)" ) ; $ qb -> setParameter ( ":$col" , $ val , Connection :: PARAM_INT_ARRAY ) ; } else { $ qb -> andWhere ( $ this -> getAlias ( ) . ".$col = :$col" ) ; $ qb -> setParameter ( ":$col" , $ val ) ; } } if ( $ orderBy ) { $ qb -> orderBy ( $ orderBy [ 0 ] , $ orderBy [ 1 ] ) ; } if ( $ limit ) { $ qb -> setMaxResults ( $ limit ) ; } if ( $ offset ) { $ qb -> setFirstResult ( $ offset ) ; } return $ qb ; }
Internal method to build a basic select, returns QB object.

@param array $criteria
@param array $orderBy
@param int   $limit
@param int   $offset

@return QueryBuilder
Internal method to build a basic select returns QB object .