code: public function getBlogTotalItems($categoryId=null)
      {
          $em = $this->container->get('doctrine')->getManager();
          $total_items = $em->getRepository('BlogBundle:Post')->countTotal($categoryId);
          
          return $total_items;
      }
docs: Returns integer
  
  @param itenger $total_items