简体   繁体   English

Sonata管理员在子列表中使用自定义路线

[英]Sonata Admin Use Custom Route in child list

I have an admin class Order that i used of 2 ways : 我有一个使用2种方式的管理类Order:

  • A classic list 经典清单
  • Included in a tab in an other Entity Contact. 包含在其他实体联系人的选项卡中。

I created a custom route in my Order Admin with a Custom Action : 我在“订单管理员”中使用“自定义操作”创建了自定义路线:

protected function configureRoutes(\Sonata\AdminBundle\Route\RouteCollection $collection)
{

    $collection->add('sendOrderByMail', '{orderNumber}/sendOrderByMail');

}

And in my list template i have : 在我的列表模板中,我有:

 <a href="{{ admin.generateUrl('sendOrderByMail', {'orderNumber': object}) }}" class="btn btn-sm btn-default view_link"><i class="fa fa-envelope"></i> Send</a>

This is it's ok in my first case (A classic list), but in my ContactAdmin where i included the OrderAdmin in child i have this error : 在我的第一种情况(经典列表)中就可以了,但是在我的ContactAdmin中,在其中包括OrderAdmin的孩子中,我有此错误:

An exception has been thrown during the rendering of a template ("unable to find the route acme_appli.admin.contact|acme_appli.admin.order.sendOrderByMail") in AcmeAppliBundle:Admin/Order:list_order.html.twig at line 11. 在第11行的AcmeAppliBundle:Admin / Order:list_order.html.twig中的模板渲染过程中引发了异常(“找不到路由acme_appli.admin.contact | acme_appli.admin.order.sendOrderByMail”)。

I don't know how to make this route ok. 我不知道该怎么做。

Thanks 谢谢

I think it's due to my cache. 我认为这是由于我的缓存。 Now it's ok because i empty this. 现在可以了,因为我清空了这个。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM