简体   繁体   中英

Sonata Admin Use Custom Route in child list

I have an admin class Order that i used of 2 ways :

  • 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 :

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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