CakePHP3でComponentからControllerを取得する方法。
CakePHP2.xではComponentのinitializeメソッドの引数でControllerを取得できたが、CakePHP3からinitializeメソッドの引数がarray $configになっているためちょっとした手間が必要なようだ。
Cake本体とやり方を合わせたかったため、AuthComponentを追いかけてみるとinitializeメソッド内に$controllerを取得している記述を発見。
public function initialize(array $config)
{
        $controller = $this->_registry->getController();
        $this->eventManager($controller->eventManager());
        $this->response =& $controller->response;
        $this->session = $controller->request->session();
}
この方法を使い、Component内では$this->controllerでControllerへアクセスできるようにする。
class HogeComponent extends Component
{
    public function initialize(array $config)
    {
        $this->controller = $this->_registry->getController();
    }
}
以降$this->controllerでHogeComponentを呼んでいるControllerを利用できる。