I'm developing a plugin in cakephp.
I have created a controller inside called PermissionsController.php
inside Plugin/Permissions/Controller
This controller extends another controller: PermissionManagerAppController.php
in the same directory.
I would like to know how to call a function inside the plugin from another controller like UsersController.php
this is my plugin controller empty now:
class PermissionsController extends PermissionManagerAppController {
public $uses = array('PermissionManager.Permission');
public function index() {
}
public function test($string) {
echo'<p>TEST: '.$string.'</p>';
}
}
I would like to call action test from another controller.
I have tried this:
App::uses('Permissions', 'PermissionsController.Controller');
class UsersController extends AppController {
public $name = 'Users';
public $scaffold;
public function beforeFilter () {
parent::beforeFilter();
$permissions = new Permissions();
$permissions->test('test');
}
}
I have also tried
App::uses('Permissions', 'Permissions.Controller');
return me always this error:
Fatal error: Class 'Permissions' not found
I have tried:
$this->permissions->test('test');
And I retrieve this error:
Fatal error: Call to a member function test() on a non-object
how to solve this?