Open jsifalda opened 9 years ago
What's the change? There's too much code to understand for me.
Look please into this file https://github.com/flame-org/Modules/blob/master/tests/unit/data/TemplateHelpersProviderExtension.php for example. Instead of returning the array there is the configurable object which provide basic API for that.
I see, basically api change.
For the router, I'd keep only router service implementing interface, without the tag. Everything else is rather redundant.
Yeah. But I think is really important be consistent. That means apply the logic with implementing interfaces for the others services as macros, helpers etc. That sounds good but this step would required DecoratorExtension? or not?
Well it depends. RouterFactory format is already used in Nette sandbox. Implementation of filters (helpers) and macros differs. Both can be services, but doesn't have to. I guess format is up to your decision. I register those in extension at the moment. Implementing interface would be really handy, since it's analogy to already used IProviders.
For adding tag dynamically (or any other operation) by interface you don't need DecoratorExtension, see https://github.com/nette/di/pull/20#issuecomment-56496574 (last code). But I dunno if it's in tagged version or in master.
I implemented the new way how to configure providers via intended Config interfaces. Finally, the Modules will be configured in OOP way and David will be glad :)
https://github.com/flame-org/Modules/commit/f3b0af5d4ebaeb0f801921719372117d9e8cdedd
Last thing what is missing is setup the routers according the new approach. Any ideas who to do that? cc @TomasVotruba ? :)