php - how do I call a public function in one controller from another controller cakephp 2.5
one text
I have 2 separate controllers and I'd like to call a public function in controller1 from controller2, see code below, so in Name2Controller within searchApplicant() function I'd like to call searchProfile() function in Name1Controller.
<?php
class Name1Controller extends AppController {
var $name = 'Name1';
var $helpers = array('Paginator','Number');
public function index() {
$this->Applicant->recursive = 0;
$this->set('applicants', $this->paginate());
}
public function searchProfile() {
}
}
<?php
class Name2Controller extends AppController {
var $name = 'Name2';
var $helpers = array('Paginator','Number');
public function index() {
}
public function searchApplicant() {
}
}
Source