FOSJs路由包

FOSJsRouting Bundle

我的 Js 路由配置有一个错误。 我得到 "Uncaught Error: The route "pspiess_letsplay_customer_new“不存在。”在我的控制台日志中。 我已经通过作曲家安装了捆绑包。 我已经完成了所有 4 个步骤

我的 Symfony 版本 2.3.21

我的应用内核

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

我的routing.yml

fos_js_routing: 资源:“@FOSJsRoutingBundle/Resources/config/routing/routing.xml”

pspiess_letsplay: 资源:“@pspiessLetsplayBundle/Controller/” 资源:“@pspiessLetsplayBundle/Resources/config/routing.yml” 前缀:/

我的路线

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

我的行动

    /**
 * 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(),
    );
}

我的js代码

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

}

我的 "router:debug" - 找到所有与我的路线一致的路线 pspiess_letsplay_booking_new 任何任何任何 /admin/booking/new

我的 "fos:js-routing:debug" - 找不到路线

我认为我的路由配置有问题,但我不知道是什么。

感谢您的帮助。

你是不是在你的日常工作中遗漏了暴露选项?

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