[TYPO3-core] Signals vs. Hooks

Markus Klein klein.t3 at reelworx.at
Mon Aug 25 19:54:09 CEST 2014


> 
> Hi Markus,
> 
> Markus Klein wrote:
> 
> > The new hook mechanism shall be based on Interfaces and shall allow
> > data manipulation (preferably via data objects
> 
> Careful with that one. You might get what you ask for ;) We had this before
> (interfaces on hooks). This breaks all extensions subscribing to a hook as
> soon as you have to modify the list of arguments. Or to state that
> otherwise: As soon as you use interfaces on hook data, you must never ever
> change the hook again.
> This makes refactoring a nightmare. And it is against the design principle of
> PHP.

We have to distinguish between interfaces for the hook function and interfaces for the DTO.
The hook interface will only specify the interface of the DTO as parameter.

So in case the hook needs a change you only create a new interface (which inherits the old one) specifying the new data.
This way, old hooks can still access the data "the old" way and you have the unique chance to properly log access to old properties.
(assuming that we only use getters to access the DTO's properties)

> 
> I am really a fan of the simple DTO data structure that is part of the PHP
> core: array(). We should make is of this in such situations.
> 
> Best regards
> --
> Philipp Gampe – PGP-Key 0AD96065 – TYPO3 UG Bonn/Köln Documentation
> – Active contributor TYPO3 CMS
> TYPO3 .... inspiring people to share!
> 
> 


Kind regards
Markus

------------------------------------------------------------
Markus Klein
TYPO3 CMS Active Contributors Team Member




More information about the TYPO3-team-core mailing list