Bug #91447
closedSimpleEnhancer don't inflate nested arguments
100%
Description
Hi,
we try to use the SimpleEnhancer to replace speaking urls into GET parameters.
Our example config is:
ExampleSimpleEnhancer: type: Simple routePath: '/fuid/{fuid}/fcat/{fcat}' _arguments: fuid: tx_example_pi1/uid fcat: tx_example_pi2/cat
We found out, that the defined arguments don't be inflated in to the nested structure of the target GET parameters.
Expected data structure:
$_GET = array ( 'tx_example_pi1' => array ( 'uid' => 123, ), 'tx_example_pi2' => array ( 'uid' => 234, ), );
By the way the PluginEnhancer does that, but all under one defined namespace and not in different data structures.
Debuggings in the SimpleEnhancer with the PluginEnhancer in mind, lead us to behavior, when we use in SimpleEnhancer::buildResult the method VariableProcessor::inflateNamespaceParameters with a fake namespace for inflating the $routeArguments, then the result will be expected.
This fix our problem in SimpleEnhancer::buildResult:
// $routeArguments = $this->getVariableProcessor()->inflateParameters($parameters, $route->getArguments()); $routeArguments = $this->getVariableProcessor()->inflateNamespaceParameters($parameters, 'foo', $route->getArguments());
Thanks for investigation and fixing.
Updated by Benni Mack over 4 years ago
- Status changed from New to Needs Feedback
Hey Stefan,
the SimpleEnhancer is meant for GET arguments without a namespace, thus - not nested. https://docs.typo3.org/m/typo3/reference-coreapi/10.4/en-us/ApiOverview/Routing/AdvancedRoutingConfiguration.html#simple-enhancer
In your case, you want to have multiple namespaces to be used. This case was not meant to be handled in TYPO3 Core (configuring one plugin at a time), for this reason, we recommend creating a custom Enhancer that does this job and fits exactly your needs.
Updated by Stefan Berger over 4 years ago
Hi Oliver,
mmh, ok. But in the meta doc examples in the class SimpleEnhancer, it show the possibility to create nested GET parameter (e.g. "category/id"):
/** * This is usually used for simple GET arguments that have no namespace (e.g. not plugins). * * routeEnhancers * Categories: * type: Simple * routePath: '/cmd/{category_id}/{scope_id}' * _arguments: * category_id: 'category/id' * scope_id: 'scope/id' */
And as far I can see, there is no reason limiting that in the SimpleEnhancer. So, is there a possibility to release that constraint, also to open up flexibility?
Updated by Benni Mack over 4 years ago
Stefan Berger wrote:
Hi Oliver,
mmh, ok. But in the meta doc examples in the class SimpleEnhancer, it show the possibility to create nested GET parameter (e.g. "category/id"):
[...]
And as far I can see, there is no reason limiting that in the SimpleEnhancer. So, is there a possibility to release that constraint, also to open up flexibility?
Hey Stefan.
currently this looks like the example in the code is wrong. The documentation above and the docs.typo3.org are correct as is.
We could loosen up that SimpleEnhancer but that would be a feature request and only make it into TYPO3 v11.
Updated by Oliver Hader over 3 years ago
- Status changed from Needs Feedback to Accepted
It's a bug... _arguments
assignment and handling should work in any places...
Updated by Gerrit Code Review over 3 years ago
- Status changed from Accepted to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/69227
Updated by Gerrit Code Review over 3 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/69227
Updated by Gerrit Code Review over 3 years ago
Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/69227
Updated by Gerrit Code Review over 3 years ago
Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/69227
Updated by Gerrit Code Review about 3 years ago
Patch set 1 for branch 10.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/70754
Updated by Gerrit Code Review about 3 years ago
Patch set 1 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/70755
Updated by Oliver Hader about 3 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset ed60c2faea9a2ffa03f9e43dd56befb596c5fe13.
Updated by Benni Mack about 3 years ago
- Related to Bug #95512: Routing: SimpleEnhancer stopped working with 9.5.31 added
Updated by Henri Nathanson about 3 years ago
- Related to Bug #95662: DOCS: SimpleRouteEnhancer adds cHash added