Controllers in CakePHP subfolders

1

I wonder how I can put controllers in subfolders in Cake? I made the following change in bootstrap.php but it did not work:

     App::build(array(
     'Controller' => array(
          ROOT . 'app/Controller/Admin/'
     )
 ));

That is, inside the Controller folder, I have a folder called Admin. I left this folder, I created a Controller called AdmController and created a function there for tests called test, but it does not work. I put the path in the browser:

http://localhost/cake/admin/adm/teste

and says that I have to create the AdminController inside the Controller folder

Does anyone know what might be happening?

Thank you

    
asked by anonymous 30.06.2014 / 15:18

1 answer

2

Try this:

App::build(array(
     'Controller' => array(
          ROOT . 'app/Controller/Admin/Adm/'
     )
));

There is also the possibility of using a plugin to do this automatically: link

But the correct way to do this in cakephp would be with prefixes, so you keep the original structure and get a /admin prefix or whatever for your application. link

    
30.06.2014 / 16:21