Project

General

Profile

Actions

Bug #89185

closed

Routing: requirements are not validated for PersistedAliasMapper in PluginEnhancer/ExtbasePluginEnhancer

Added by Georg Tiefenbrunn over 4 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Link Handling, Site Handling & Routing
Target version:
-
Start date:
2019-09-17
Due date:
% Done:

0%

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

Description

I'd like to add a requirement for an aspect of type PersistedAliasMapper on a custom slug field:

routeEnhancers:
  ExamplePlugin:
    type: Extbase
    extension: Example
    plugin: Entities
    routes:
      -
        routePath: '/{entity}'
        _arguments:
          entity: entity
    requirements:
      entity: '^...$'
    aspects:
      entity:
        type: PersistedAliasMapper
        tableName: tx_myext_domain_model_entity
        routeFieldName: slug

Routing and link generation works like expected, but /{entity} isn't validated.

PLease have a look at function PluginEnhancer::getNamespacedRequirements():

    protected function getNamespacedRequirements(): array
    {
        $requirements = [];
        foreach ($this->configuration['requirements'] ?? [] as $name => $value) {
            $requirements[$this->namespace . '_' . $name] = $value;
        }
        return $requirements;
    }

This will store the requirement as $requirements['tx_example_entities_entity'] but function VariableProcessor::deflateValues() uses VariableProcessor::LEVEL_DELIMITER which is __ (double underscore).

Altering getNamespacedRequirements() to also use double underscore fixes this issue.


Related issues 2 (0 open2 closed)

Related to TYPO3 Core - Task #88686: Fix requirements in parameterClosed2019-07-04

Actions
Related to TYPO3 Core - Bug #86895: routeEnhancer not working correct for paginate widgetClosed2018-11-09

Actions
Actions

Also available in: Atom PDF