[BUGFIX] Prevent warning during extension installation 82/47382/2
authorNicole Cordes <typo3@cordes.co>
Thu, 24 Mar 2016 11:35:26 +0000 (12:35 +0100)
committerBenni Mack <benni@typo3.org>
Thu, 31 Mar 2016 17:39:36 +0000 (19:39 +0200)
Currently a warning is triggered if you try to install an extension
which has dependencies as the JsonView uses some own implementation to
convert objects into json with using Reflections. This patch adds some
view configuration to exclude a getter function which needs an argument
to prevent the warning.

Resolves: #75256
Releases: master
Change-Id: Ic63513d36f98f37ae0ab344349d7a85010e5aada
Reviewed-on: https://review.typo3.org/47382
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
typo3/sysext/extensionmanager/Classes/Controller/DownloadController.php

index 07804bd..c738219 100644 (file)
@@ -59,6 +59,11 @@ class DownloadController extends AbstractController
     protected $defaultViewObjectName = JsonView::class;
 
     /**
+     * @var JsonView
+     */
+    protected $view;
+
+    /**
      * @param \TYPO3\CMS\Extensionmanager\Domain\Repository\ExtensionRepository $extensionRepository
      */
     public function injectExtensionRepository(\TYPO3\CMS\Extensionmanager\Domain\Repository\ExtensionRepository $extensionRepository)
@@ -127,6 +132,11 @@ class DownloadController extends AbstractController
         $hasDependencies = false;
         $hasErrors = false;
         $dependencyTypes = null;
+        $configuration = [
+            'value' => [
+                'dependencies' => [],
+            ],
+        ];
         if ($this->configurationUtility->getCurrentConfiguration('extensionmanager')['automaticInstallation']['value']) {
             $action = 'installFromTer';
             try {
@@ -137,6 +147,14 @@ class DownloadController extends AbstractController
                     foreach ($dependencyTypes as $dependencyType => $dependencies) {
                         $extensions = '';
                         foreach ($dependencies as $extensionKey => $dependency) {
+                            if (!isset($configuration['value']['dependencies'][$dependencyType])) {
+                                $configuration['value']['dependencies'][$dependencyType] = [];
+                            }
+                            $configuration['value']['dependencies'][$dependencyType][$extensionKey] = [
+                                '_exclude' => [
+                                    'categoryIndexFromStringOrNumber',
+                                ],
+                            ];
                             $extensions .= $this->translate(
                                 'downloadExtension.dependencies.extensionWithVersion',
                                 array(
@@ -169,6 +187,7 @@ class DownloadController extends AbstractController
             ['extension' => $extension->getUid(), 'format' => 'json'],
             'Download'
         );
+        $this->view->setConfiguration($configuration);
         $this->view->assign('value', [
             'dependencies' => $dependencyTypes,
             'url' => $url,