przewiń do treści

Symfony 2 od podstaw

Włodzimierz Gajda

class KontynentController extends Controller
{
    /**
     * Lista kontynentow
     *
     * @Route("/kontynenty.html", name="kontynent_index")
     * @Template()
     */
    public function indexAction()
    {
        $em = $this->getDoctrine()->getEntityManager();
        $entities = $em->getRepository('MyFrontendBundle:Kontynent')->findAll();
        return array('entities' => $entities);
    }
}

Listing 32.15. Kontroler Kontynent

Rozdział 32. Relacje 1:n (jeden do wielu)

listing-32-15.txt

Reklama

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