Issue Bug Closed

#90399Unable to use EventDispatcherInterface in custom TreeDataProvider

Christoph Lehmann 02/16/20, 17:08 updated 02/17/20, 08:54

Description

https://docs.typo3.org/m/typo3/reference-tca/master/en-us/ColumnsConfig/Type/Select.html#treeconfig allows to set a custom DataProvider.

In TYPO3.CMS/typo3/sysext/core/Classes/Tree/TableConfiguration/TreeDataProviderFactory.php:43 the custom DataProvider is created but there is no check if it implements the EventDispatcherInterface.

        if (!empty($tcaConfiguration['treeConfig']['dataProvider'])) {
            $dataProvider = GeneralUtility::makeInstance($tcaConfiguration['treeConfig']['dataProvider'], $tcaConfiguration, $table, $field, $currentValue);
        }

This ends in an exception:

“Argument 1 passed to TYPO3\\CMS\\Core\\Tree\\TableConfiguration\\MyTreeDataProvider::__construct() must implement interface Psr\\EventDispatcher\\EventDispatcherInterface, array given.

The custom DataProvider looks like this

<?php
namespace TYPO3\CMS\Core\Tree\TableConfiguration;
class MyTreeDataProvider extends DatabaseTreeDataProvider {}

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.