[TASK] Introduce object implementation registry
authorHelmut Hummel <helmut.hummel@typo3.org>
Sat, 24 Nov 2012 17:48:28 +0000 (18:48 +0100)
committerHelmut Hummel <helmut.hummel@typo3.org>
Sun, 25 Nov 2012 11:20:17 +0000 (12:20 +0100)
commit39789b9c0b871c5a7ac96488cf67648ba340b93d
tree7b742b6f6924b39fe8d619c4f2e70f701b6b8662
parentd6d98473a53d38fb30c99612e2c74ad1496fa1ab
[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
t3lib/stddb/DefaultConfiguration.php
typo3/sysext/core/Classes/Compatibility/CompatbilityClassLoaderPhpBelow50307.php
typo3/sysext/core/Classes/Core/ClassLoader.php
typo3/sysext/core/Classes/Utility/GeneralUtility.php
typo3/sysext/core/Migrations/Code/LegacyClassesForIde.php
typo3/sysext/core/Tests/Unit/Compatibility/CompatbilityClassLoaderPhpBelow50307Test.php
typo3/sysext/core/Tests/Unit/Core/ClassLoaderTest.php
typo3/sysext/core/Tests/Unit/Utility/GeneralUtilityTest.php