-
-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Transfer base controller to the yii-web package #53
Comments
I think it's not the best idea. While base controller might be convenient, I think it's much better to have a set of traits in |
This controller may be useful in another modules (e.g.
How will you inject dependencies in this case (e.g. |
Yes, good question. Overall, idea of base controller is controversial: https://twitter.com/sam_dark/status/1227328185680977921 To me, it's convenient and I don't see any critical drawbacks despite it being formally not correct. |
And what's the solution? |
I think the abstract controller should be in the app template. There is no need to move it to the yii-web package. |
I think that the controller sould be moved, but not now. The controller is not yet complete. When he ceases to be a draft and finds a stable state, then he will have to be transferred |
Yes, we can wait with this one. Another possibility from that Twitter thread is to wrap view-resolving into its own class and inject it as a dependency i.e. ControllerView that decorates WebView and adds automatic view path resolving. |
I'm for having But it is crucial to have an AbstractController in template at least, as some of my beginner developers (in studio I own) were not sure what to do with all this packages and how to render views after using yii2 extensively and AbstractController will just make their lives easier. |
@armpogart why do you need AbstractController if a controller can be any Middleware? |
That's same discussion I had on Twitter: #53 (comment). If we can achieve convenience without abstract controller, that will be ideal. If not — abstract controller isn't that bad. |
@roxblnfk I see it just as a convenient quick start abstract parent (with some helpers) for the most frequent use case per app template. As it will be in app-template any dev will be free to just delete it if he/she doesn't intend to use it. I would rather propose to have some traits with helpers instead of abstract parent but it would be impossible to inject dependencies in that case and create useful helper. |
I am sure that many users do not need to configure the controller for themselves at all.
And those who need it will be able to inherit the basic controller and supplement it, or create their own.
Also since the class is abstract, please rename it
AbstractController
The text was updated successfully, but these errors were encountered: