سؤال

I am doing migration of cakephp 1.3 to 2.0 . i follow the cakephp migration guide but after the upgrade i get following error.

Notice: Undefined index: controller in C:\xampp\htdocs\pro\lib\Cake\Routing\Dispatcher.php


( ! ) Fatal error: Uncaught exception 'MissingControllerException' with message 'Controller class Controller could not be found.' in C:\xampp\htdocs\pro\lib\Cake\Routing\Dispatcher.php on line 83
( ! ) MissingControllerException: Controller class Controller could not be found. in C:\xampp\htdocs\pro\lib\Cake\Routing\Dispatcher.php on line 83

Can any one guide me what i have done wrong if some one already pass through same situation? Any help will be appreaciated.

هل كانت مفيدة؟

المحلول

Check the source

The error message comes from the dispatch function:

public function dispatch(CakeRequest $request, CakeResponse $response, $additionalParams = array()) {
    if ($this->asset($request->url, $response) || $this->cached($request->here)) {
        return;
    }

    $request = $this->parseParams($request, $additionalParams);
    Router::setRequestInfo($request);
    $controller = $this->_getController($request, $response);

    if (!($controller instanceof Controller)) {
        throw new MissingControllerException(array( # line 83
            'class' => Inflector::camelize($request->params['controller']) . 'Controller',
            'plugin' => empty($request->params['plugin']) ? null : Inflector::camelize($request->params['plugin'])
        ));
    }

    return $this->_invoke($controller, $request, $response);
}

Which means: No route matched the request.

A common cause for that is to miss loading the default routes which is responsible for the catchall routes which in 1.3 are automatic.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top