You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now if I want to link extension to concrete page Controller, I need to get an instance of it (usually through $dependencies -> constructor -> instance variable) and call addExtension in init method.
This brings a generous amount of boilerplate while currently there's no easy way to define a set of extensions which should be used on multiple controllers, without their explicit definition or some other helper that calls the addExtension behind the scenes.
API Extension proposals
I propose additional 2 methods that can be used along with the original API. These try to minimize the boilerplate needed, focus on better readability and reusability.
1. $extensions
The first addition is in a form of new $extensions static getter in the Controllers. This would work the same way as the current $dependencies (e.g. the instances are handled by the ObjectContainer), while eliminating the usually not-needed boilerplate.
Would be cool if both options also accept array of extension classes. (This could be used to bind array of global extension to certain alias and only use this alias)
Current state
Right now if I want to link extension to concrete page Controller, I need to get an instance of it (usually through
$dependencies
->constructor
->instance variable
) and calladdExtension
ininit method
.This brings a generous amount of boilerplate while currently there's no easy way to define a set of extensions which should be used on multiple controllers, without their explicit definition or some other helper that calls the
addExtension
behind the scenes.API Extension proposals
I propose additional 2 methods that can be used along with the original API. These try to minimize the boilerplate needed, focus on better readability and reusability.
1.
$extensions
The first addition is in a form of new
$extensions
static getter in the Controllers. This would work the same way as the current$dependencies
(e.g. the instances are handled by the ObjectContainer), while eliminating the usually not-needed boilerplate.this would also simplify the definition of global extension stacks:
2. Extensions defined in the router itself
The Extensions definition would take place while defining the route along with it's view and controller:
The same benefits as with the first solution apply here.
Both API extensions should work along with the current implementation (unless there's no way to leave them both in the code).
The text was updated successfully, but these errors were encountered: