Hello everyone,
I am new to Laminas and while following the tutorial, I encountered an error when creating my first controller.
PHP Fatal error: Class Site\Controller\IndexController contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (Laminas\Mvc\Controller\AbstractController::onDispatch)
What does this mean?
What’s the function of this onDispatch method?
Why is it necessary I add it to my Controller?
On the tutorial building album application, there is nothing like that.
You extended Laminas\Mvc\Controller\AbstractController, which is not aware about actions.
What you want is Laminas\Mvc\Controller\AbstractActionController; AbstractActionController extends AbstractController and implements AbstractController::onDispatch() to select and execute appropriate action method.