BlogBundle/Twig/BlogExtension.php
public function countPost($actor)
    {
        $em = $this->container->get('doctrine')->getManager();
        $entities = $em->getRepository('BlogBundle:Post')->findBy(array('actor' => $actor));
        
        return count($entities);
    }
public function countPost($actor)
    {
        $em = $this->container->get('doctrine')->getManager();
        $entities = $em->getRepository('BlogBundle:Post')->findBy(array('actor' => $actor));
        
        return count($entities);
    }
Returns integer counter

@param object $actor