I have managed to update a simple component to Joomla 4 still using the MVC file structure and am now learning the new file structure layout with namespaces etc. When I have processed a record in my model and return to the controller, my redirects don't seem to work as I was expecting. I'm guessing this is due to my lack of knowledge around the new Router?
So, when I return to the controller I want it to redirect to the menu item used (if it exists) using the my old code as follows:
$menu = Factory::getApplication()->getMenu();
$item = $menu->getActive();
$this->setRedirect(Route::_($item->link, false));
The menuitem object always returns the default and not the actual menuitem used prior to the processing.
I've basically copied the Service/Router from com_banner. Any advice/guidance much appreciated. Cheers.
Glenn