code: 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;
      }
docs: Returns array posts
  
  @param object $post