AppBundle\Controller\Admin\BlogController::indexAction PHP Метод

indexAction() публичный Метод

This controller responds to two different routes with the same URL: * 'admin_post_index' is the route with a name that follows the same structure as the rest of the controllers of this class. * 'admin_index' is a nice shortcut to the backend homepage. This allows to create simpler links in the templates. Moreover, in the future we could move this annotation to any other controller while maintaining the route name and therefore, without breaking any existing link.
public indexAction ( )
    public function indexAction()
    {
        $entityManager = $this->getDoctrine()->getManager();
        $posts = $entityManager->getRepository('AppBundle:Post')->findAll();
        return $this->render('admin/blog/index.html.twig', array('posts' => $posts));
    }