przewiń do treści

Symfony 2 od podstaw

Włodzimierz Gajda

class DefaultController extends Controller
{

    /**
     * @Route("/")
     * @Template()
     */
    public function indexAction()
    {
        $em = $this->getDoctrine()->getEntityManager();
        $entities = $em->getRepository('MyFrontendBundle:Mountain')->findAll();
        return array('entities' => $entities);
    }

}

Listing 19.15. Kod akcji index

Rozdział 19. Dostosowywanie klas dostępu do bazy danych

listing-19-15.txt

Reklama

Szkolenia z Symfony 2.1
©2012 Włodzimierz Gajda
ver. 1.0.1