How to call a function inside the app_controller.php in app/app_controller.php in the behavior of a plugin which is at app/plugins/media/models/behaviors/transfer.php inside a method called transferTo.
2 Answers
You don't. Models and/or behaviors should not talk back to the controller. If the method is so universally usable, make it a function in bootstrap.php, put it in AppModel if it's applicable there or create your own utility class in /app/libs that you can call statically from anywhere.
(You can call AppController::myMethod() anywhere, provided you're in a normal request cycle where the AppController is already loaded, or use ClassRegistry::init to get an instance of any controller (which will have the method), but this'll probably create more problems than it solves. Don't do this.)
Comments
You can use the requestAction() for this. The requestAction is a way to call any controller function from any different controller.
The syntax is
$response = $this->requestAction('name of controller/action_name/'.$parameter);
you will get the result in $response variable.