BlogBundle/Twig/BlogExtension.php
public function getPosts($limit=null, $offset=null)
    {
        $em = $this->container->get('doctrine')->getManager();
        if(is_null($limit) && is_null($offset)){
            $entities = $em->getRepository('BlogBundle:Post')->findBy(array(),array('published' =>  'DESC'));
        }elseif(is_null($limit) && !is_null($offset)){
            $entities = $em->getRepository('BlogBundle:Post')->findBy(array(),array('published' =>  'DESC'), $limit);
        }elseif(!is_null($limit) && !is_null($offset)){
            $entities = $em->getRepository('BlogBundle:Post')->findBy(array(),array('published' =>  'DESC'), $limit, $offset);
        }
        
        return $entities;
    }
public function getPosts($limit=null, $offset=null)
    {
        $em = $this->container->get('doctrine')->getManager();
        if(is_null($limit) && is_null($offset)){
            $entities = $em->getRepository('BlogBundle:Post')->findBy(array(),array('published' =>  'DESC'));
        }elseif(is_null($limit) && !is_null($offset)){
            $entities = $em->getRepository('BlogBundle:Post')->findBy(array(),array('published' =>  'DESC'), $limit);
        }elseif(!is_null($limit) && !is_null($offset)){
            $entities = $em->getRepository('BlogBundle:Post')->findBy(array(),array('published' =>  'DESC'), $limit, $offset);
        }
        
        return $entities;
    }
Returns array posts

@param object $post