I'm trying to get all of the methods / actions of all the controllers from my CakePHP application.
I can not bring the methods of all controllers and I do not understand why.
I tried to import App::import
and with App::uses
, but get_class_methods()
does not return methods / actions of all.
Here's what I created:
//Pega a lista de controllers da aplicação e adiciona num array;
$controllersApp = App::objects('controller');
//Varre o array de controllers da aplicação e adiciona cada item num array global
foreach($controllersApp as $c)
{
$temp_listControllers[] = $c;
}
//Pega a lista de plugins
$plugins = App::objects('plugin');
//Varre o array de plugins
foreach($plugins as $plugin)
{
//Cria string para pegar lista de Controllers de cada Plugin: Plugin.controller
$p = $plugin.'.controller';
//Pega lista de controllers do Plugin corrente em $plugin
$lista = App::objects($p);
//Varre o array de controllers do Plugin corrente e adiciona cada item no array global
foreach($lista as $l)
{
$temp_listControllers[] = $l;
}
}
foreach($temp_listControllers as $c)
{
//$r = str_replace("Controller", "", $c);
$listControllers[] = $c;
}
foreach($listControllers as $controller)
{
$actions = get_class_methods($controller);
echo "<hr /><h1>".$controller."</h1>";
pr($actions);
}
Am I doing something wrong? Is there any other way to do this?