Extending Extbase domain models and controllers using XCLASS
TL;DR - In TYPO3 12+, use XCLASS to extend existing extbase domain models and controllers. For TYPO3 9.5 - 11.5
use XCLASS and registerImplementation()
as shown below.
In TYPO3 9.5 LTS it has been
deprecated (see notice)
to extend Extbase classes using TypoScript config.tx_extbase.objects
and plugin.tx_%plugin%.objects
. In order
to migrate existing extensions, which extends another TYPO3 extension, you should now use XLASSes.
For my TYPO3 Extension sf_event_mgt I also provide a small demo
extension, which shows how to extend domain models and controllers of the main extension. The previous version using
config.tx_extbase.objects
can be found here. I
migrated this demo extension to use XCLASSes instead.
The code below shows, how two models and one controller are extended using XCLASS.
For domain models in TYPO3 9.5 - 11.5, the important part is the registerImplementation() call, since this instructs Extbase to use the extended domain model when an object is processed by the property mapper. For TYPO3 12 the registerImplementation() call is not required any more.
Note, that there are some limitations using XCLASS, so it is highly recommended to read the official documentation.