php bin /控制台调试:路由器| grep postbox消息
pt__RG__admin_mea_postbox_postboxmessage_list ANY ANY ANY /admin/mea/postbox/postboxmessage/list
pl__RG__admin_mea_postbox_postboxmessage_list ANY ANY ANY /pl/admin/mea/postbox/postboxmessage/list
en__RG__admin_mea_postbox_postboxmessage_list ANY ANY ANY /en/admin/mea/postbox/postboxmessage/list
pt__RG__admin_mea_postbox_postboxmessage_create ANY ANY ANY /admin/mea/postbox/postboxmessage/create
pl__RG__admin_mea_postbox_postboxmessage_create ANY ANY ANY /pl/admin/mea/postbox/postboxmessage/create
en__RG__admin_mea_postbox_postboxmessage_create ANY ANY ANY /en/admin/mea/postbox/postboxmessage/create
pt__RG__admin_mea_postbox_postboxmessage_batch ANY ANY ANY /admin/mea/postbox/postboxmessage/batch
pl__RG__admin_mea_postbox_postboxmessage_batch ANY ANY ANY /pl/admin/mea/postbox/postboxmessage/batch
en__RG__admin_mea_postbox_postboxmessage_batch ANY ANY ANY /en/admin/mea/postbox/postboxmessage/batch
pt__RG__admin_mea_postbox_postboxmessage_edit ANY ANY ANY /admin/mea/postbox/postboxmessage/{id}/edit
pl__RG__admin_mea_postbox_postboxmessage_edit ANY ANY ANY /pl/admin/mea/postbox/postboxmessage/{id}/edit
en__RG__admin_mea_postbox_postboxmessage_edit ANY ANY ANY /en/admin/mea/postbox/postboxmessage/{id}/edit
pt__RG__admin_mea_postbox_postboxmessage_delete ANY ANY ANY /admin/mea/postbox/postboxmessage/{id}/delete
pl__RG__admin_mea_postbox_postboxmessage_delete ANY ANY ANY /pl/admin/mea/postbox/postboxmessage/{id}/delete
en__RG__admin_mea_postbox_postboxmessage_delete ANY ANY ANY /en/admin/mea/postbox/postboxmessage/{id}/delete
pt__RG__admin_mea_postbox_postboxmessage_export ANY ANY ANY /admin/mea/postbox/postboxmessage/export
pl__RG__admin_mea_postbox_postboxmessage_export ANY ANY ANY /pl/admin/mea/postbox/postboxmessage/export
en__RG__admin_mea_postbox_postboxmessage_export ANY ANY ANY /en/admin/mea/postbox/postboxmessage/export
pt__RG__admin_mea_postbox_postboxmessage_send ANY ANY ANY /admin/mea/postbox/postboxmessage/send
pl__RG__admin_mea_postbox_postboxmessage_send ANY ANY ANY /pl/admin/mea/postbox/postboxmessage/send
en__RG__admin_mea_postbox_postboxmessage_send ANY ANY ANY /en/admin/mea/postbox/postboxmessage/send
pt__RG__admin_app_postboxthread_postboxmessage_list ANY ANY ANY /admin/app/postboxthread/{id}/postboxmessage/list
pl__RG__admin_app_postboxthread_postboxmessage_list ANY ANY ANY /pl/admin/app/postboxthread/{id}/postboxmessage/list
en__RG__admin_app_postboxthread_postboxmessage_list ANY ANY ANY /en/admin/app/postboxthread/{id}/postboxmessage/list
pt__RG__admin_app_postboxthread_postboxmessage_create ANY ANY ANY /admin/app/postboxthread/{id}/postboxmessage/create
pl__RG__admin_app_postboxthread_postboxmessage_create ANY ANY ANY /pl/admin/app/postboxthread/{id}/postboxmessage/create
en__RG__admin_app_postboxthread_postboxmessage_create ANY ANY ANY /en/admin/app/postboxthread/{id}/postboxmessage/create
pt__RG__admin_app_postboxthread_postboxmessage_batch ANY ANY ANY /admin/app/postboxthread/{id}/postboxmessage/batch
pl__RG__admin_app_postboxthread_postboxmessage_batch ANY ANY ANY /pl/admin/app/postboxthread/{id}/postboxmessage/batch
en__RG__admin_app_postboxthread_postboxmessage_batch ANY ANY ANY /en/admin/app/postboxthread/{id}/postboxmessage/batch
pt__RG__admin_app_postboxthread_postboxmessage_edit ANY ANY ANY /admin/app/postboxthread/{id}/postboxmessage/{childId}/edit
pl__RG__admin_app_postboxthread_postboxmessage_edit ANY ANY ANY /pl/admin/app/postboxthread/{id}/postboxmessage/{childId}/edit
en__RG__admin_app_postboxthread_postboxmessage_edit ANY ANY ANY /en/admin/app/postboxthread/{id}/postboxmessage/{childId}/edit
pt__RG__admin_app_postboxthread_postboxmessage_delete ANY ANY ANY /admin/app/postboxthread/{id}/postboxmessage/{childId}/delete
pl__RG__admin_app_postboxthread_postboxmessage_delete ANY ANY ANY /pl/admin/app/postboxthread/{id}/postboxmessage/{childId}/delete
en__RG__admin_app_postboxthread_postboxmessage_delete ANY ANY ANY /en/admin/app/postboxthread/{id}/postboxmessage/{childId}/delete
pt__RG__admin_app_postboxthread_postboxmessage_show ANY ANY ANY /admin/app/postboxthread/{id}/postboxmessage/{childId}/show
pl__RG__admin_app_postboxthread_postboxmessage_show ANY ANY ANY /pl/admin/app/postboxthread/{id}/postboxmessage/{childId}/show
en__RG__admin_app_postboxthread_postboxmessage_show ANY ANY ANY /en/admin/app/postboxthread/{id}/postboxmessage/{childId}/show
pt__RG__admin_app_postboxthread_postboxmessage_export ANY ANY ANY /admin/app/postboxthread/{id}/postboxmessage/export
pl__RG__admin_app_postboxthread_postboxmessage_export ANY ANY ANY /pl/admin/app/postboxthread/{id}/postboxmessage/export
en__RG__admin_app_postboxthread_postboxmessage_export ANY ANY ANY /en/admin/app/postboxthread/{id}/postboxmessage/export
php bin /控制台路由器:match / en / admin / app / postboxthread / {id} / postboxmessage / list
[确定]路线“ en__RG__admin_app_postboxthread_postboxmessage_list”匹配
+--------------+-------------------------------------------------------------------------------------------+
| Property | Value |
+--------------+-------------------------------------------------------------------------------------------+
| Route Name | en__RG__admin_app_postboxthread_postboxmessage_list |
| Path | /en/admin/app/postboxthread/{id}/postboxmessage/list |
| Path Regex | #^/en/admin/app/postboxthread/(?P<id>[^/]++)/postboxmessage/list$#sD |
| Host | ANY |
| Host Regex | |
| Scheme | ANY |
| Method | ANY |
| Requirements | NO CUSTOM |
| Class | Symfony\Component\Routing\Route |
| Defaults | _controller: Mea\PostBoxBundle\Sonata\Controller\PostBoxMessageCrudController::listAction |
| | _locale: en |
| | _sonata_admin: mea.postbox.sonata.admin.thread|mea.postbox.sonata.admin.message |
| | _sonata_name: admin_app_postboxthread_postboxmessage_list |
| Options | compiler_class: Symfony\Component\Routing\RouteCompiler |
+--------------+-------------------------------------------------------------------------------------------+
此示例部分工作,但我猜这条路线:)
PostBoxThreadAdmin
/**
* {@inheritdoc}
*/
protected function configureTabMenu(MenuItemInterface $menu, $action, AdminInterface $childAdmin = null): void
{
if (!$childAdmin && !in_array($action, ['edit'])) {
return;
}
$admin = $this->isChild() ? $this->getParent() : $this;
$id = $admin->getRequest()->get('id');
if ($this->isGranted('EDIT')) {
$menu->addChild('Edit Thread', [
'uri' => $admin->generateUrl('edit', ['id' => $id])
]);
}
$menu->addChild('Messages',
$admin->generateMenuUrl('mea.postbox.sonata.admin.message.list', ['id' => $id])
);
}
当我尝试
$menu->addChild('Messages',
$admin->generateMenuUrl('mea.postbox.sonata.admin.message', ['id' => $id])
);
获取
An exception has been thrown during the rendering of a template ("unable to find the route `mea.postbox.sonata.admin.thread|mea.postbox.sonata.admin.message`").
尝试
$menu->addChild('Messages',
$admin->generateMenuUrl('mea.postbox.sonata.admin.thread|mea.postbox.sonata.admin.message', ['id' => $id])
);
获取
An exception has been thrown during the rendering of a template ("unable to find the route `mea.postbox.sonata.admin.thread|mea.postbox.sonata.admin.thread|mea.postbox.sonata.admin.message`").
尝试
$menu->addChild('Messages',
$admin->generateMenuUrl('admin_app_postboxthread_postboxmessage_list', ['id' => $id])
);
获取
An exception has been thrown during the rendering of a template ("unable to find the route `mea.postbox.sonata.admin.thread.admin_app_postboxthread_postboxmessage_list`").
当我使用
$ menu-> addChild('Messages', $ admin-> generateMenuUrl('mea.postbox.sonata.admin.message.list',['id'=> $ id]) );
显示子面板,但是当我创建新面板并保存时-我得到
unable to find the route `mea.postbox.sonata.admin.thread|mea.postbox.sonata.admin.message.send`
RuntimeException
in vendor/sonata-project/admin-bundle/src/Route/DefaultRouteGenerator.php (line 109)
in vendor/sonata-project/admin-bundle/src/Route/DefaultRouteGenerator.php->generateMenuUrl (line 60)
in vendor/Mea/PostBoxBundle/Sonata/Admin/PostBoxMessageAdmin.php->generateUrl (line 190)
in vendor/sonata-project/admin-bundle/src/Admin/AbstractAdmin.php->configureFormFields (line 1267)
in vendor/sonata-project/admin-bundle/src/Admin/AbstractAdmin.php->defineFormBuilder (line 1254)
in vendor/sonata-project/admin-bundle/src/Admin/AbstractAdmin.php->getFormBuilder (line 2980)
in vendor/sonata-project/admin-bundle/src/Admin/AbstractAdmin.php->buildForm (line 1311)
in vendor/sonata-project/admin-bundle/src/Controller/CRUDController.php->getForm (line 336)
in vendor/symfony/http-kernel/HttpKernel.php->editAction (line 149)
in vendor/symfony/http-kernel/HttpKernel.php->handleRaw (line 66)
in vendor/symfony/http-kernel/Kernel.php->handle (line 188)
Kernel->handle(object(Request))
in public/index.php (line 37)
Request::setTrustedHosts(explode(',', $trustedHosts));}$kernel = new Kernel($env, $debug);$request = Request::createFromGlobals();$response = $kernel->handle($request);$response->send();$kernel->terminate($request, $response);
因此,奏鸣曲尝试使用_sonata_admin路由:mea.postbox.sonata.admin.thread | mea.postbox.sonata.admin.message但无法访问
答案 0 :(得分:0)
您可以这样做:
'uri' => str_replace('{id}',$id,'/admin/app/property/{id}/property-media/list')
如果需要路线,可以通过以下方式找到它:
bin/console debug:router