Module **** isn't registered in the application container

Hi,

I have a problem when i try to redirect to an other page.

i have this error : Exception: Module '*****' isn't registered in the application container

My router :

$router->add('/', array(
        "namespace" => 'Controllers\*****',
        "controller" => 'index',
        "action" => 'index'
    ));  

    $registered_modules = array();
    $controller_dir = __DIR__."/../controllers/";

    foreach (glob($controller_dir."*", GLOB_ONLYDIR) as $namespace_name) {
        $module_name = basename($namespace_name);

        $registered_modules[strtolower($module_name)]= "Controllers\\".$module_name;
    }
    // add routing for all controllers, using the following convention:
    // \module\controller\action\params
    // where module is mapped to the corresponding namespace
    foreach ($registered_modules as $module_name => $namespace_name) {
        $router->add("/".$module_name."/", array(
            "namespace" => $namespace_name,
             "module" => $module_name
        ));

        $router->add("/".$module_name."/:controller/", array(
            "module" => $module_name,
            "namespace" => $namespace_name,
            "controller" => 1
        ));

        $router->add("/".$module_name."/:controller/:action/", array(
            "module" => $module_name,
            "namespace" =>  $namespace_name,
            "controller" => 1,
            "action" => 2
        ));

        $router->add("/".$module_name."/:controller/:action/:params", array(
            "module" => $module_name,
            "namespace" => $namespace_name,
            "controller" => 1,
            "action" => 2,
            "params" => 3
        ));

        $router->add("/".$module_name."/:controller/:action/:params", array(
            "module" => $module_name,
            "namespace" => $namespace_name,
            "controller" => 1,
            "action" => 2,
            "params" => 3
        ))->setName('routertest');

    }

    $router->handle();

    return $router;

My indexController :

namespace Controllers\*****;

use Phalcon\Mvc\Controller;

class IndexController extends Controller
{
    public function indexAction()
    {
        //DebugBreak("[email protected];d=1,p=0");
        $this->response->redirect("madera/login/index", true);
        $this->view->disable();
    }
}

and my LoginController :

namespace Controllers\*****;

use Phalcon\Mvc\Controller;
use Models\Madera\Authentifaction;

class LoginController extends Controller
{
    public function indexAction()
    { 
        $ident = $this->request->getPost("ident");
        $pwd = $this->request->getPost("password");

        $auth = new Authentifaction();

        $result = $auth->find(
            [
                "Login = $ident AND Mot_De_Passe = $pwd"
            ]
        );

        $this->view->result;

I don't know why he dosen't find the module. It's the same for IndexController.

Sorry for my bad english.



1.7k

Hi,

problem solved, in the router it's "m" for module and not "module".