1
votes

i have an error wir my Js Routing configuration. I get "Uncaught Error: The route "pspiess_letsplay_customer_new" does not exist." in my console log. I have installed the bundle via composer. i have done all the 4. Steps

My Symfony version 2.3.21

My AppKernel

        $bundles = array(
        //.....
        new pspiess\LetsplayBundle\pspiessLetsplayBundle(),
        new Knp\Bundle\MenuBundle\KnpMenuBundle(),
        new Braincrafted\Bundle\BootstrapBundle\BraincraftedBootstrapBundle(),
        new JMS\SerializerBundle\JMSSerializerBundle(),
        new FOS\JsRoutingBundle\FOSJsRoutingBundle(),
        //.....
    );

My routing.yml

fos_js_routing: resource: "@FOSJsRoutingBundle/Resources/config/routing/routing.xml"

pspiess_letsplay: resource: "@pspiessLetsplayBundle/Controller/" resource: "@pspiessLetsplayBundle/Resources/config/routing.yml" prefix: /

My route

pspiess_letsplay_customer_new:
pattern:  /admin/customer/new
defaults: { _controller: pspiessLetsplayBundle:Customer:new }

My Action

    /**
 * Displays a form to create a new Customer entity.
 *
 * @Route("/new", name="customer_new")
 * @Method("GET")
 * @Template()
 */
public function newAction() {
    $entity = new Customer();
    $form = $this->createCreateForm($entity);

    return array(
        'entity' => $entity,
        'form' => $form->createView(),
    );
}

My Js Code

click: function() {
  console.log(Routing.generate('pspiess_letsplay_customer_new'));

}

My "router:debug" - all routes found with my route pspiess_letsplay_booking_new ANY ANY ANY /admin/booking/new

My "fos:js-routing:debug" - no route found

I think there is something wrong wirth my routing configuration, but i dont know what.

Thanks for help.

1

1 Answers

1
votes

Arent you missing the expose option in your routing ?

pspiess_letsplay_customer_new:
pattern:  /admin/customer/new
defaults: { _controller: pspiessLetsplayBundle:Customer:new }
options:
    expose: true