Nov 21, 2014 Tag: Extbase
Thanks to Sebastian Fischer it can be easy now to extend the domain model of an existing extension. Sebastian presented his TYPO3 CMS extension ‘extender’ at the T3CRR 2014 in Essen. This post gives a very short description and howto.
Updated on Mar 11, 2015
See also: About Extbase
Overview:
Sometimes the domain model of an existing extension doesn’t cover all your needs and you wish to add extra functionality without having to touch the original code. There is good news: ‘ext:extender’ is available from TER and lets you do exactly that.
Here is a short example:
Let’s take ‘FrontendUser’ as an example for a domain model you want to enhance. It is part of the sf_register extension.’ So go ahead and install that extension. There is nothing special to prepare here.
Install the extender extension. Again: There’s nothing to change here.
Create a new extension ‘ew_sfregister_extended’. This is where all your code for the new functionality goes.
Add your additional classes that inherit from the original ones. Add properties, getters and setters as needed.
Note: Only add properties, getters and setters that are not part of the original model!
Add TCA, ext_tables.sql and more as needed.
Add a dependency for ‘extender’ in file ext_emconf
to garantee
that ‘extender’ is installed whenever ‘ew_sfregister_extended’ is installed.
Now add all the magic with this line in ext_localconf.php
:
$GLOBALS['TYPO3_CONF_VARS']
['EXTCONF']['sf_register']['extender']
['FrontendUser']['ew_sfregister_extended'] =
'EXT:ew_sfregister_extended/Classes/Domain/Model/FrontendUser.php';
Clear the system cache.
Enjoy!
The example is based on Sebastian’s real life extension ‘ew_sfregister_extended’ that can be found at Github: https://github.com/evoWeb/ew_sfregister_extended
Thank you very much!