-
-
Notifications
You must be signed in to change notification settings - Fork 53
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
Do we really need notFoundAction? #21
Comments
One small remark: removing notFoundAction would allow us to remove Zend\Mvc\View\Http\RouteNotFoundStrategy listener (prepareNotFoundViewModel) from the dispatch event listeners. Currently we are checking the status code of the response for each and every request (https://github.com/zendframework/zend-mvc/blob/master/src/View/Http/RouteNotFoundStrategy.php#L174), which, in my opinion, is a bad practice: 404 status code isn't a general thing in an application. Listeners of the dispatch event should do general things, unless we don't want bad performance. Originally posted by @wesperinteractive at zendframework/zend-mvc#204 (comment) |
+1 I'm having the same issue with the notFoundAction in Zend 3. I want to catch dispatch errors but they are never thrown when an action that doesn't exist is called on a controller. This issue has been opened since Oct. 2016 but it hasn't been assigned to anyone and it hasn't been labelled? Originally posted by @burrellramone at zendframework/zend-mvc#204 (comment) |
The zend-mvc component is subject to some changes which are under development. Originally posted by @froschdesign at zendframework/zend-mvc#204 (comment) |
Closing issue due to being inactive for more than 1 year. |
The question is simple: do we really need notFoundAction?
https://github.com/zendframework/zend-mvc/blob/master/src/Controller/AbstractActionController.php#L43
I don't think so...
My problems:
What should be done?
(I think it would be better than the old ERROR_CONTROLLER_CANNOT_DISPATCH, which means nothing for me, it's too general.)
After that we could do small simplifications in RouteNotFoundReason, and remove weird lines (!!!) similar to this one: https://github.com/zendframework/zend-mvc/blob/master/src/View/Http/RouteNotFoundStrategy.php#L231
By the way, that line and this switch case (https://github.com/zendframework/zend-mvc/blob/master/src/View/Http/RouteNotFoundStrategy.php#L135) perfectly shows how illogical the error handling in it's current form is. There are errors (retrieved via getError from MvcEvent) and there is ERROR_CONTROLLER_CANNOT_DISPATCH.
(The impossibility of retrieving the error type ERROR_CONTROLLER_CANNOT_DISPATCH from the MvcEvent via the getError method can cause further problems too. Let's say we would like to log them...)
Opinions?
Originally posted by @wesperinteractive at zendframework/zend-mvc#204
The text was updated successfully, but these errors were encountered: