Project

General

Profile

Actions

Bug #91447

closed

SimpleEnhancer don't inflate nested arguments

Added by Stefan Berger almost 4 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Link Handling, Site Handling & Routing
Target version:
-
Start date:
2020-05-20
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
9
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

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.


Related issues 2 (1 open1 closed)

Related to TYPO3 Core - Bug #95512: Routing: SimpleEnhancer stopped working with 9.5.31Closed2021-10-07

Actions
Related to TYPO3 Core - Bug #95662: DOCS: SimpleRouteEnhancer adds cHashAccepted2021-10-15

Actions
Actions #1

Updated by Benni Mack almost 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.

Actions #2

Updated by Oliver Hader almost 4 years ago

  • Description updated (diff)
Actions #3

Updated by Stefan Berger almost 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?

Actions #4

Updated by Benni Mack almost 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.

Actions #5

Updated by Oliver Hader almost 3 years ago

  • Status changed from Needs Feedback to Accepted

It's a bug... _arguments assignment and handling should work in any places...

Actions #6

Updated by Gerrit Code Review almost 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

Actions #7

Updated by Gerrit Code Review almost 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

Actions #8

Updated by Gerrit Code Review almost 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

Actions #9

Updated by Gerrit Code Review almost 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

Actions #10

Updated by Gerrit Code Review over 2 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

Actions #11

Updated by Gerrit Code Review over 2 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

Actions #12

Updated by Oliver Hader over 2 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #13

Updated by Benni Mack over 2 years ago

  • Status changed from Resolved to Closed
Actions #14

Updated by Benni Mack over 2 years ago

  • Related to Bug #95512: Routing: SimpleEnhancer stopped working with 9.5.31 added
Actions #15

Updated by Henri Nathanson over 2 years ago

  • Related to Bug #95662: DOCS: SimpleRouteEnhancer adds cHash added
Actions

Also available in: Atom PDF