public function findAllWithPagination($filters, $limit, $offset, $resultInArray = FALSE)
    {
        $where = $this->getQueryFilter($filters);
        $query = $this->getEntityManager()->createQuery('SELECT m FROM FulgurioLightCMSBundle:Media m ' . $where . ' ORDER BY m.created_at DESC')->setMaxResults($limit)->setFirstResult($offset);
        if (!empty($filters))
        {
            foreach ($filters as $filterKey => $filterValue)
            {
                $query->setParameter($filterKey, $filterValue);
            }
        }
        if ($resultInArray)
        {
            return $query->getArrayResult();
        }
        return $query->getResult();
    }
public function findAllWithPagination($filters, $limit, $offset, $resultInArray = FALSE)
    {
        $where = $this->getQueryFilter($filters);
        $query = $this->getEntityManager()->createQuery('SELECT m FROM FulgurioLightCMSBundle:Media m ' . $where . ' ORDER BY m.created_at DESC')->setMaxResults($limit)->setFirstResult($offset);
        if (!empty($filters))
        {
            foreach ($filters as $filterKey => $filterValue)
            {
                $query->setParameter($filterKey, $filterValue);
            }
        }
        if ($resultInArray)
        {
            return $query->getArrayResult();
        }
        return $query->getResult();
    }
public function findAllWithPagination ( $ filters , $ limit , $ offset , $ resultInArray = FALSE ) { $ where = $ this -> getQueryFilter ( $ filters ) ; $ query = $ this -> getEntityManager ( ) -> createQuery ( 'SELECT m FROM FulgurioLightCMSBundle:Media m ' . $ where . ' ORDER BY m.created_at DESC' ) -> setMaxResults ( $ limit ) -> setFirstResult ( $ offset ) ; if ( ! empty ( $ filters ) ) { foreach ( $ filters as $ filterKey => $ filterValue ) { $ query -> setParameter ( $ filterKey , $ filterValue ) ; } } if ( $ resultInArray ) { return $ query -> getArrayResult ( ) ; } return $ query -> getResult ( ) ; }
Find media with pagination

@param array $filters
@param number $limit
@param number $offset
@param boolean $resultInArray

@return array
Find media with pagination