#76217Extend the XCLASS philosophy to also work with interfaces to gain flexibility for the core and make TYPO3 more accessible for others
Description
The XCLASS wording in a weird term that origins from the history of TYPO3. It makes TYPO3 less accessible for others. In fact the matter is about a general principle, interfaces, interfaces as the general meaning, in which each class is an interface itself.
The implementation works already by using classes as interfaces, that can be implemented by other classes. In other words classes that extends the original class.
MyTimeTracker can replace TimeTracker, if MyTimeTracker extends TimeTracker.
The request of this ticket is to put this on a more general level to work with interfaces, too.
Assume both implement a TimeTrackerInterface. It would be registered as:
$GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects']['TimeTrackerInterface']['className']
TimeTracker or MyTimeTracker can do the job, if they implement TimeTrackerInterFace
The one, which is registered later, would be used. Registrations by an extension would replace the registration of the core.
Now what is changed by this, apart from being more abstract?
For the existing classes nothing changes, but the interface approach can be used to gain flexibility for the core.
If an interface is defined, the core needs to register it’s class for the interface, too. In one central configuration file the core can easily customised for purposes of testing or to address different requirements. Based on conditions, different classes could be selected.
To leverage the registration an utility could be handy:
GeneralUtility::registerClass($classname, $interfaceName) {
$GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects']$interfaceName]['className'] = $className;
}Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.