[TYPO3-dev] Hooks with interface
    Malte Jansen 
    mail at maltejansen.de
       
    Sun Mar  1 11:31:06 CET 2009
    
    
  
Hi Steffen,
you could create a second interface, which is extended by the old one.
So you just have to check in the code, if the interface is an instanceOf 
  second interface.
e.g.
interface MyHook {
   some functions...
}
interface MyBetterHook extends MyHook {
   additional functions...
}
class MyClass {
   1. load functions with instanceOf MyHook... (there is a PHP-function 
for getting the classes, without reflection)
   2. run MyHook things
      and
      run MyBetterHook things, checking the instanceOf MyBetterHook before.
}
Cheers,
Malte
Steffen Kamper schrieb:
> Hi,
> 
> now we have the rule that new hooks has to come with an interface. That 
> is good as everyone see in interface which hooks are present and how to 
> implement them.
> But - If we extend the interface with a new method, all extensions using 
> the interface won't work any more as they don't have the new method in 
> the hook, which i think is a big problem.
> See as example t3lib_tceformsInlineHook where it will needed one day to 
> implement a new method as the interface is for the complete class.
> 
> How to prevent such future errors?
> 
> vg Steffen
    
    
More information about the TYPO3-dev
mailing list