php bin/console debug:router |grep postboxmessage
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/console router:match /en/admin/app/postboxthread/{id}/postboxmessage/list
[OK] Route "en__RG__admin_app_postboxthread_postboxmessage_list" matches
+--------------+-------------------------------------------------------------------------------------------+
| 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 |
+--------------+-------------------------------------------------------------------------------------------+
This example partial work, but this route I guessed :)
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])
);
}
When i try
$menu->addChild('Messages',
$admin->generateMenuUrl('mea.postbox.sonata.admin.message', ['id' => $id])
);
get
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`").
try
$menu->addChild('Messages',
$admin->generateMenuUrl('mea.postbox.sonata.admin.thread|mea.postbox.sonata.admin.message', ['id' => $id])
);
get
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`").
try
$menu->addChild('Messages',
$admin->generateMenuUrl('admin_app_postboxthread_postboxmessage_list', ['id' => $id])
);
get
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`").
When i use
$menu->addChild('Messages', $admin->generateMenuUrl('mea.postbox.sonata.admin.message.list', ['id' => $id]) );
child panel is shown but when i create new and save - i get
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);
So Sonata try use route _sonata_admin: mea.postbox.sonata.admin.thread|mea.postbox.sonata.admin.message but is not accessible