-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Move error view model generation methods to abstract controller #6956
Move error view model generation methods to abstract controller #6956
Conversation
These could actually be moved to controller plugins... Not sure if it represents a BC break though. |
We can move implementation to controller plugins and keep the methods as proxies for BC 👍 |
Good hint, @danizord! |
Should we keep them as proxies in AbstractActionController or AbstractController? I guess they should still be moved since it makes much more sense to have them available in AbstractController implementations. Going further, if the method will be there, does it really make sense to have it as a controller plugin? since it can't be removed from AbstractActionController anyway? |
I would keep the change as small as possible. Don't move the methods, just make them proxy through to |
But does it make sense even to move them to separate files? the methods will still be there anyway... y not moving them and forget about the plugins? what advantage would we have by moving them to plugins instead of keeping the methods there, since we can't remove them because of BC? @Ocramius Also, do you have any code sample for that proxy behavior? |
The point is that you can override all of them in one shot. Utility methods in controllers provide great additional flexibility for RAD. We can't remove them as people may rely on |
Could you please update the list of plugins defined in |
$this->assertSame("Page not found", $model->getResult()); | ||
$this->assertSame(1, $model->getErrorLevel()); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EOF EOL
👍 |
Accessing |
@Pittiplatsch I'm just worried about subclasses overriding the method. We can remove those methods later on |
@Ocramius Sry, I don't exactly understand the problem. Overriding is exactly what I did in my 3v4l, isn't it? |
Yes, but you can't expect the plugin manager to be always the same :-) Anyway, I'm just being very defensive here. |
Note: should add |
…otFoundModel()` and `AbstractController#createConsoleNotFoundModel()` (to be removed in 2.5)
…Model()` and `AbstractController#createConsoleNotFoundModel()`
…r plugin to be interacting on it as a unit test
…otFoundModel` into a unit test
…ler-plugins' into develop Close #6956
@fabiocarneiro I manually merged this PR after applying some cleanups.
|
I want those methods to be moved from the AbstractActionController to AbstractController since they're important even if you want to dispatch directly instead of having many actions (which is what i'm doing).
Otherwise, i'll have to create my own extension of AbstractController or a trait and use it in all my project controllers, which would make necessary to have a "base" module.
The tests will still pass because the methods will be still be available in AbstractActionController, since it is an extension of AbstractController. I chose not to move the notFoundAction since it is an action and should stay in AbstractActionController.
With this update, we'll be able to: