flame-org / Modules

Nette modules on the Steroids
http://flame-org.github.io/Modules/
GNU Lesser General Public License v3.0
13 stars 7 forks source link

Better configuration of Routes (according "The New Way") #22

Open jsifalda opened 9 years ago

jsifalda commented 9 years ago

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 ? :)

TomasVotruba commented 9 years ago

What's the change? There's too much code to understand for me.

jsifalda commented 9 years ago

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.

TomasVotruba commented 9 years ago

I see, basically api change.

For the router, I'd keep only router service implementing interface, without the tag. Everything else is rather redundant.

jsifalda commented 9 years ago

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?

TomasVotruba commented 9 years ago

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.