[TASK] DBAL: Autoloading for userdefined database-handler 49/32949/4
authorStefan Neufeind <typo3.neufeind@speedpartner.de>
Wed, 24 Sep 2014 01:26:47 +0000 (03:26 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Fri, 5 Jun 2015 09:28:47 +0000 (11:28 +0200)
Make specifying a classFile optional. If not given,
it may simply be loaded using the autoloader.

Change-Id: Ib8168d014f814a58d1e58e641287cc64bee3e095
Resolves: #61829
Releases: master
Reviewed-on: http://review.typo3.org/32949
Reviewed-by: Benjamin Mack <benni@typo3.org>
Reviewed-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Tested-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/core/Documentation/Changelog/master/Deprecation-61829-DbalConfigClassFile.rst [new file with mode: 0644]
typo3/sysext/dbal/Classes/Database/DatabaseConnection.php

diff --git a/typo3/sysext/core/Documentation/Changelog/master/Deprecation-61829-DbalConfigClassFile.rst b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-61829-DbalConfigClassFile.rst
new file mode 100644 (file)
index 0000000..196b534
--- /dev/null
@@ -0,0 +1,27 @@
+============================================================
+Deprecation: #61829 - Deprecate config.classFile DBAL option
+============================================================
+
+Description
+===========
+
+The DBAL option ``config.classFile`` has been marked for deprecation,
+and will be removed with TYPO3 CMS 8.
+
+
+Impact
+======
+
+Using ``config.classFile`` option will throw a deprecation message.
+
+
+Affected Installations
+======================
+
+Installations which use a userdefined DBAL database-handler.
+
+
+Migration
+=========
+
+Load the class using the autoloader.
index 9bccb0b..6e8f8d2 100644 (file)
@@ -3115,12 +3115,16 @@ class DatabaseConnection extends \TYPO3\CMS\Core\Database\DatabaseConnection {
                                }
                                break;
                        case 'userdefined':
-                               // Find class file:
-                               $fileName = GeneralUtility::getFileAbsFileName($cfgArray['config']['classFile']);
-                               if (@is_file($fileName)) {
-                                       require_once $fileName;
-                               } else {
-                                       throw new \RuntimeException('DBAL error: "' . $fileName . '" was not a file to include.', 1310027975);
+                               // if not set class may also be loaded by autoload on demand
+                               if (isset($cfgArray['config']['classFile'])) {
+                                       GeneralUtility::deprecationLog('The DBAL handler option "config.classFile" is deprecated since TYPO3 CMS 7, and will be removed with CMS 8. Make use of autoloading instead.');
+                                       // Find class file:
+                                       $fileName = GeneralUtility::getFileAbsFileName($cfgArray['config']['classFile']);
+                                       if (@is_file($fileName)) {
+                                               require_once $fileName;
+                                       } else {
+                                               throw new \RuntimeException('DBAL error: "' . $fileName . '" was not a file to include.', 1310027975);
+                                       }
                                }
                                // Initialize:
                                $this->handlerInstance[$handlerKey] = GeneralUtility::makeInstance($cfgArray['config']['class']);