Platform does not sound like a normal page, is it a Custom File or an external page? If it is Custom File, make sure the URL is correct. You can check valid routes and URLs by php bin/console router:debug, see Console Commands.
If you have added the route recently or using "production" mode, make sure you have cleared cache, read: Clearing Symfony Cache.
While reviewing the code, I noticed something that may need clarification.
In page classes, terminate() can set:
$this->Response = new RedirectResponse(GetUrl($url), Config("REDIRECT_STATUS_CODE"));
However, in BaseController::runPage(), $page->Response is only checked before page rendering:
if (($response = $page->Response) instanceof Response) {
...
$page->terminate();
}
Later, terminate() is called again, but I cannot find any code that re-reads $page->Response after terminate() has executed.
From my reading, if terminate() creates a new RedirectResponse, that response does not appear to be assigned back to the controller's $response variable and therefore may never be returned.
Am I missing another location where $page->Response is consumed after terminate() runs, or is the Response created inside terminate() no longer used in the Symfony-based architecture?
I noticed another potential issue related to IsModal.
In terminate() there is logic like:
if ($this->IsModal) {
...
}
However, IsModal is typically assigned during run():
public function run(): void
{
// Is modal
$this->IsModal = IsModal();
}
I have encountered cases where terminate() is executed before run() (or before other methods that initialize $this->IsModal). In those situations, $this->IsModal may not contain the expected value, which can lead to incorrect behavior.
As a workaround, I have sometimes used:
public function pageUnload(): void
{
$this->IsModal = IsModal();
}
to ensure the property is initialized before terminate() uses it.
Would it be safer for terminate() to call IsModal() directly instead of relying on $this->IsModal, for example:
if (IsModal()) {
...
}
or is there another part of the framework lifecycle that guarantees $this->IsModal has already been initialized before terminate() is called?
Note that terminate() can only be called once, if you call it again, since it is already terminated, it returns early.
Normal usage calls run() then terminate(), the latter will not be called before run(). If there are special cases that you terminate early yourself in some server event, you should know if the page is used as modal or not, and you can set the response as JSON response or Redirect response accordingly. (There should be no need to use pageUnload() just to set IsModal.)
Note that if "Platform" is not a valid route, you will get "No route found" error (and no redirection). That's why I suggested that you should:
You can check valid routes and URLs by php bin/console router:debug , see Console Commands.
Make sure the displayed valid routes and their URLs contains where you want to direct (e.g. "Platform".
A modal dialog is closed by returning JSON properly. In normal operation by generated code, the server side will return properly JSON response (no error, or has error in JSON, or has URL in JSON) and then the dialog will be closed. If you return JSON response yourself by server event, you may want to press F12 in your browser, check for JavaScript error in Console pnale and check HTTP response in Network panel, and see what your response actually returns, try to find why it does not close the dialog. If you returns text/html or invalid JSON, it won't work.