Bug #90480

resolveControllerAliasFromControllerClassName returns wrong alias

Added by Daniel Lorenz 9 months ago. Updated 9 months 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.

#1

Updated by Gerrit Code Review 9 months ago

  • Status changed from New 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/+/63361

#2

Updated by Gerrit Code Review 9 months 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/+/63361

#3

Updated by Gerrit Code Review 9 months 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/+/63361

#4

Updated by Alexander Schnitzler 9 months ago

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

I guess you mean: The method should return Cart\CartPreview instead of just CartPreview?

#5

Updated by Gerrit Code Review 9 months 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/+/63361

#6

Updated by Daniel Lorenz 9 months ago

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

Updated by Benni Mack 9 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF