Project

General

Profile

Actions

Bug #90480

closed

resolveControllerAliasFromControllerClassName returns wrong alias

Added by Daniel Gohlke almost 5 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Must have
Assignee:
Category:
Extbase
Target version:
-
Start date:
2020-02-21
Due date:
% Done:

100%

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

Description

The new method to resolve an alias from the given controller class name in ExtensionUtility::configurePlugin does not respect any subdirectories in the controller directory.

As a result, the corresponding template of the controller is not found, because the wrong directory is searched.

An example how it works in TYPO3 v8 and v9:

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
    'Extcode.cart',
    'MiniCart',
    [
        'Cart\CartPreview' => 'show',
        'Cart\Currency' => 'update',
    ],
    // non-cacheable actions
    [
        'Cart\CartPreview' => 'show',
        'Cart\Currency' => 'update',
    ]
);

There is a controller \Extcode\Cart\Controller\Cart\CartPreviewController according to the plugin registration above. For the actions of the controller the templates are located in Resources/Private/Templates/Cart/CartPreview.

The new plugin registration looks like this.

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
    'Cart',
    'MiniCart',
    [
        \Extcode\Cart\Controller\Cart\CartPreviewController::class => 'show',
        \Extcode\Cart\Controller\Cart\CurrencyController::class => 'update',
    ],
    // non-cacheable actions
    [
        \Extcode\Cart\Controller\Cart\CartPreviewController::class => 'show',
        \Extcode\Cart\Controller\Cart\CurrencyController::class => 'update',
    ]
);

The new method generates an alias from the given class name. To generate this alias, only the last part of the class name is used, not the entire namespace.

The method should return Cart\CartPreview instead of Cart\CartPreview.

Actions

Also available in: Atom PDF