I am having some difficulties rerouting to a dynamic URL from within my controller.
in routes.ini
GET /admin/profiles/patient/@patientId/insert-report = Admin->createReport
in the controller Admin.php, in method createReport():
$patientId = $f3->get('PARAMS.patientId');
My attempt (in Admin.php):
$f3->reroute('admin/profiles/patient/' . echo (string)$patientId . '/insert-report');
Question: How to reroute to the same URL (where some error messages will be displayed) without changing completely the routing, that is attaching patientId as a URL query parameter ?
Thanks, K.
The
echostatement is not needed to concatenate strings:Here are 3 other ways to get the same result:
1) build the URL from the current pattern
(useful for rerouting to the same route with a different parameter)
2) reroute to the same pattern, same parameters
(useful for rerouting from POST/PUT/DELETE to GET of the same URL)
3) build the URL from a named route
(useful for rerouting to a different route)
or shorthand syntax: