[TASK] Introduce object implementation registry
With 6.0 all Xclass inclusion in the classes have been removed and registration of Xclasses have previously been moved to the autoloader. This added additional complexity and another concern to the class loader. To enable extensions to override classes, an object implementation registry is now introduced, where you can now define which implementation class name should be used for an original class. This not only is a complete replacement for former Xclasses, but at the same time adds the possibility to have the implementation class name within the namespace and scope of the extension which registers the override. On top it would also be possible to register implementations for interfaces. Since only class names are mapped here, we again have a clear separation of concerns, where the class loader is only responsible to resolve paths for class names and the "object manager" method makeInstance for resolving the final class name to instantiate. The path of the target class can be resolved automatically by the class loader if naming conventions are met or the target class name is put into the autoloading registry. An implementation of a class can be registered like this: $TYPO3_CONF_VARS['SYS']['Objects']['originalClass'] = array('className' => 'targetClass'); The patch adjusts the ClassLoader and makeInstance. The unit tests for the ClassLoader are removed since it is not responsible for resolving Xclasses any more. Instead unit tests for makeInstance are added to test the new behavior. Resolves: #43269 Releases: 6.0 Change-Id: I04198b178aa41f02d7a5b7ee990ff24f483990f5 Reviewed-on: http://review.typo3.org/16712 Reviewed-by: Steffen Ritter Reviewed-by: Anja Leichsenring Tested-by: Anja Leichsenring Tested-by: Steffen Ritter Reviewed-by: Christian Kuhn Reviewed-by: Helmut Hummel Tested-by: Helmut Hummel
Showing
- t3lib/stddb/DefaultConfiguration.php 1 addition, 0 deletionst3lib/stddb/DefaultConfiguration.php
- typo3/sysext/core/Classes/Compatibility/CompatbilityClassLoaderPhpBelow50307.php 0 additions, 1 deletion...es/Compatibility/CompatbilityClassLoaderPhpBelow50307.php
- typo3/sysext/core/Classes/Core/ClassLoader.php 2 additions, 6 deletionstypo3/sysext/core/Classes/Core/ClassLoader.php
- typo3/sysext/core/Classes/Utility/GeneralUtility.php 27 additions, 5 deletionstypo3/sysext/core/Classes/Utility/GeneralUtility.php
- typo3/sysext/core/Migrations/Code/LegacyClassesForIde.php 4 additions, 4 deletionstypo3/sysext/core/Migrations/Code/LegacyClassesForIde.php
- typo3/sysext/core/Tests/Unit/Compatibility/CompatbilityClassLoaderPhpBelow50307Test.php 0 additions, 1 deletion...ompatibility/CompatbilityClassLoaderPhpBelow50307Test.php
- typo3/sysext/core/Tests/Unit/Core/ClassLoaderTest.php 0 additions, 71 deletionstypo3/sysext/core/Tests/Unit/Core/ClassLoaderTest.php
- typo3/sysext/core/Tests/Unit/Utility/GeneralUtilityTest.php 22 additions, 0 deletionstypo3/sysext/core/Tests/Unit/Utility/GeneralUtilityTest.php
Please register or sign in to comment