FIXED: Issue where route table arguments would not be accessible without using non deprecated API #740
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request is for a "fix" for a gap in the api.
Previously any arguments specified on the routing table would be saved in Director::urlParams() and could be retrieved by the controller. For example, my routes.yml file looks like the below:
In 2.4 the "Locale" parameter would be available, but trying to access this in SS 3.0 via Director::urlParams() gives a deprecation error, noting that SS_HTTPRequest->latestParams() should be used instead. Since only arguments in the url pattern (URLSegment, Action, etc) are actually stored in the request object, this actually represents a degradation in functionality.
My fix is to ensure that during routing these additional parameters are correctly passed to the request object and stored, so that they may be retrieved via $this->request->params().
Note: This pull request is based on a previous attempt to solve this problem which had a few issues involved with it. Hopefully this implementation resolves those issue. :)
The original pull request can be found at #711 for reference.
This implementation of the problem differs from the original in that it: