Issues (153)

Configuration/TCA/Overrides/be_users.php (1 issue)

Labels
Severity
1
<?php
2
3
defined('TYPO3') or die();
4
5
6
$beUsersSiteFcn = function() {
7
8
    $list = [['', '']];
9
10
    try {
11
        $config = \Aimeos\Aimeos\Base::config();
12
        $context = \Aimeos\Aimeos\Base::context($config);
13
14
        $result = $context->db('db-locale')->create('SELECT * FROM "mshop_locale_site" ORDER BY "nleft"')->execute();
15
        $parents = [];
16
17
        $fcn = function($result, $parents, $right) use (&$fcn, &$list) {
18
19
            while ($row = $result->fetch()) {
20
                $list[] = [join(' > ', array_merge($parents, [$row['label']])), $row['siteid']];
21
22
                if ($row['nright'] - $row['nleft'] > 1) {
23
                    $fcn($result, array_merge($parents, [$row['label']]), $row['nright']);
24
                }
25
26
                if ($row['nright'] + 1 == $right) {
27
                    return;
28
                }
29
            }
30
        };
31
32
        while ($row = $result->fetch()) {
33
            $list[] = [$row['label'], $row['siteid']];
34
35
            if ($row['nright'] - $row['nleft'] > 1) {
36
                $fcn($result, array_merge($parents, [$row['label']]), $row['nright']);
37
            }
38
        }
39
    }
40
    catch(\Exception $e) {
41
        $log = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Log\LogManager::class);
0 ignored issues
show
The type TYPO3\CMS\Core\Utility\GeneralUtility was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
42
        $log->getLogger(__CLASS__)->warning('Unable to retrieve Aimeos sites: ' . $e->getMessage());
43
    }
44
45
    return $list;
46
};
47
48
49
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('be_users', [
50
    'siteid' => [
51
        'label' => 'LLL:EXT:aimeos/Resources/Private/Language/admin.xlf:beusers_site.title',
52
        'config' => [
53
            'type' => 'select',
54
            'renderType' => 'selectSingle',
55
            'items' => $beUsersSiteFcn(),
56
        ]
57
    ]
58
]);
59
60
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes('be_users', 'siteid', '', 'after:password');
61
62