Variable existiert nicht in symfony2

Ich habe Folgendes problem auf meinem symfony2 Projekt:

Dies ist der code von meinem controller

public function showCustomerAction($id) {
    //retrieve the customer from the database
    $em = $this->getDoctrine()->getManager();
    $customer = $em->getRepository('VictorIoSiteBundle:Customer')->find($id);

    //throw new \Exception($customer);
    return $this->render('VictorIoSiteBundle:Site:viewCustomer.html.twig', array('customer' => $customer));
}

Und den code von meinem Zweig-Ansicht (ganz einfach):

{% if customer is defined %}
    <h3>Customer: {{ customer }} </h3>
{% endif %}

Endlich meinen Arbeitsplan.yml

victor_io_site_show_customer:
pattern: /show-customer/{id}
defaults: { _controller: VictorIoSiteBundle:Site:showCustomer }
requirements:
    id: \d+

Nun, wenn ich gehen auf

http://localhost/Garage/web/app_dev.php/show-customer/46

Bekomme ich die folgende Fehlermeldung :

Variable " customer " does not exist in VictorIoSiteBundle:Site:viewCustomer.html.twig at line 2
500 Internal Server Error - Twig_Error_Runtime
InformationsquelleAutor Victor | 2013-10-21
Schreibe einen Kommentar