componentでcontrollerの関数を使う方法

[CakePHP2]componentでcontrollerの関数を使う方法

コンポーネントを自作している時に、コントローラーの関数を使いたい場面があったのでメモ。

protected $_controller = null;

public function __construct(ComponentCollection $collection, $settings = array()) {
    $this->_controller = $collection->getController();
    parent::__construct($collection, $settings);
}
$this->_controller->render('custom_file');