chore: remove IncomingRequest deprecations - #9851
Conversation
neznaika0
left a comment
There was a problem hiding this comment.
Good. Working on deprecations is important as new features.
|
Thank you @neznaika0 and @paulbalandan! |
|
My project has unfortunately been broken because of this change. What sort of work around is there? We route by domain.com/{tenant}/dashboard/... We used setPath on the incoming request to remove {tenant}/ and have the new auto routing work on everything after it. With it being made private, the entire platform routing doesn't work. I can modify the path via reflection, but since it's not a maintained solution, I worry about the long term effects. Any advice? |
|
@cncoa I'm sorry this change affected your project. A custom router may be a good fit for this use case. You can override namespace App\Routing;
use CodeIgniter\Router\Router;
final class TenantRouter extends Router
{
public function autoRoute(string $uri)
{
$segments = explode('/', trim($uri, '/'), 2);
$routePath = $segments[1] ?? '/';
parent::autoRoute($routePath === '' ? '/' : $routePath);
}
}The custom router then needs to be registered as the router service in This keeps the rest of the request unchanged and modifies only the path passed to Auto Routing. Explicit routes are still checked against the original URI before Tenant validation and resolution can be handled separately, for example in a filter using the first segment of the original URI. |
Description
This PR removes deprecated methods from the
IncomingRequestclass.The deprecated
$configparameter has been removed fromsetPath(), and the method visibility has been changed frompublictoprivate.Checklist: