CakePHP get action name
action, cakephp, controller, php
Solution
You should use the request object.
CakePHP 3.3 and below
$this->request->params['action'];
Since 3.4
$this->request->getParam('action');
I think this should contain the real method name that was called. CakePHPs router resolves the string URL to a controller / action pair and other args, all of that ends up in the request object. Read the documentation and do `debug($this->request);` in your beforeFilter() to see what else is there.
Problem
In CakePHP, it is possible to get the called function string using the ``` $this->action ``` syntax. It returns the literal string of whatever is called, so if the URL is `/do_this`, it returns `do_this`, and if it's `doThis` it'll return `doThis`. Regardless of the called method's real name. What I am looking for, on the other hand, is the called method's actual name, no matter the URL syntax. Is there a way to find it out? I'd preferably be able to do this in the `beforeFilter` method.