[BUGFIX] Call to a member function getTreeList() on null 29/58629/2
authorStanislas Rolland <typo3@sjbr.ca>
Sun, 14 Oct 2018 18:45:58 +0000 (14:45 -0400)
committerStanislas Rolland <typo3@sjbr.ca>
Sun, 14 Oct 2018 18:47:07 +0000 (20:47 +0200)
Load ConfigurationManagerInterface rather than ConfigurationManager.

Change-Id: I81e0c0495287ea4936568851e4b7a673f6ce4f6e
Resolves: #84258
Reviewed-on: https://review.typo3.org/58629
Reviewed-by: Stanislas Rolland <typo3@sjbr.ca>
Tested-by: Stanislas Rolland <typo3@sjbr.ca>
ChangeLog
Classes/Utility/ModelUtility.php

index 8e938bf..f524414 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,7 @@
 
        * Resolves #86610: Add schema migration service and dumping utility
        * Resolves #86654: Migrate extension update script to TYPO3 LTS 9
+       * Resolves #84258: Call to a member function getTreeList() on null
 
 2018-10-11  Stanislas Rolland  <typo3(arobas)sjbr.ca>
 
index 85cf878..6904dec 100644 (file)
@@ -1,10 +1,11 @@
 <?php
 namespace SJBR\StaticInfoTables\Utility;
+
 /***************************************************************
 *  Copyright notice
 *
 *  (c) 2014 Tim Lochm├╝ller <tim.lochmueller@hdnet.de>
-*  (c) 2014 Stanislas Rolland <typo3(arobas)sjbr.ca>
+*  (c) 2014-2018 Stanislas Rolland <typo3(arobas)sjbr.ca>
 *
 *  All rights reserved
 *
@@ -30,15 +31,16 @@ namespace SJBR\StaticInfoTables\Utility;
 
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
+use TYPO3\CMS\Extbase\Object\ObjectManager;
 
-class ModelUtility {
-
+class ModelUtility
+{
        /**
         * Internal Extbase configuration
         *
         * @var array
         */
-       private static $extbaseConfiguration = NULL;
+       private static $extbaseConfiguration = null;
 
        /**
         * Mapping for the table name
@@ -57,14 +59,13 @@ class ModelUtility {
         * @param string $configurationType
         * @return string
         */
-       static public function getModelMapping($modelName, $mappingType) {
-               if (self::$extbaseConfiguration === NULL) {
-                       /** @var \TYPO3\CMS\Extbase\Object\ObjectManager $objectManager */
-                       $objectManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
-                       /** @var \TYPO3\CMS\Extbase\Configuration\ConfigurationManager $configurationManager */
-                       $configurationManager = $objectManager->get('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManager');
+       static public function getModelMapping($modelName, $mappingType)
+       {
+               if (self::$extbaseConfiguration === null) {
+                       $objectManager = GeneralUtility::makeInstance(ObjectManager::class);
+                       $configurationManager = $objectManager->get(ConfigurationManagerInterface::class);
                        self::$extbaseConfiguration = $configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
                }
-               return self::$extbaseConfiguration['persistence']['classes'][$modelName]['mapping'][$mappingType] ? : NULL;
+               return self::$extbaseConfiguration['persistence']['classes'][$modelName]['mapping'][$mappingType] ?: null;
        }
 }
\ No newline at end of file