[TYPO3-ect] Which pattern to use?
Joerg Schoppet
joerg at schoppet.de
Tue May 30 14:04:12 CEST 2006
Ok, so here is my suggestion:
it has a lot of the observer pattern and a little bit of hooks.
my base-fe-user-class has a private var called e.g. "extensions" and two methods atach() and detach().
If an extension wants to extend the base-fe-user-class it registers the class in a global array or a registry-object in ext_localconf.php (because I think, this file is always included for each loaded extension).
if a new base-fe-user-object is created, the constructor walks through the global array or registry-object and ataches each found class as a new object to its private var. (Because the ext_localconf.php-files are loaded in the order they are needed). When such a extension-object is created it gets a reference to the base-fe-user-class through the constructor.
Now, when a method is called, which is not in the base-fe-class I have the magic-func __call which iterates through the extension-array and looks, if a extension-object implements such a method.
For already implemented methods, I haven't the final clue. I think I need a pre- and post-function hook, so that the extension-objects can alter the methods.
How does this sounds?
Joerg
More information about the TYPO3-team-extension-coordination
mailing list