przewiń do treści

Symfony 2 od podstaw

Włodzimierz Gajda

/**
* @Route("/{id}.html", name="song_show")
 * @Template()
 */
public function showAction($id)
{
    $em = $this->getDoctrine()->getEntityManager();
    $entity = $em->getRepository('MyFrontendBundle:Song')->find($id);

    if (!$entity) {
        throw $this->createNotFoundException('Podana strona nie istnieje!');
    }

    return array('entity' => $entity);
}

Listing 26.8. Kod akcji show

Rozdział 26. Akcja show

listing-26-08.txt

Reklama

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