CakePHP 2.3.0 component $controller is not accessible -
i using cakephp 2.3.0, loading following component.
class breadcrumbscomponent extends component { public $components = array(); public $controller = null; public function initialize($controller) { } public function startup($controller) { $this->controller = $controller; } public function beforerender($controller) { } public function shutdown($controller) { } public function beforeredirect($controller, $url, $status = null, $exit = true) { } public function handle($controllername = null, $actionname = null) { pr($this->controller->modelclass); } }
it error following error
trying property of non-object [app\controller\component\breadcrumbscomponent.php, line 38] i unable access $this->controller there. reason? how make work?
read here startup method called after controller need initialize controller in initialize method below,
public function initialize(&$controller, $settings = array()) { $this->controller = $controller; }
Comments
Post a Comment