Review main Merged

16712[TASK] Introduce object implementation registry

Christian Kuhn CR +2 V +2 Normal +34 −88 updated 06/03/13, 20:49

Commit message

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.

Review

  • Code review CR +2

    Imported before Forger kept the single votes, the next import adds them.

  • Verified V +2

    Imported before Forger kept the single votes, the next import adds them.

Issues 1

Files 8