diff --git a/src/DI/Extension.php b/src/DI/Extension.php index b4b56dd..a6415da 100644 --- a/src/DI/Extension.php +++ b/src/DI/Extension.php @@ -184,11 +184,11 @@ protected function createApplication(ContainerBuilder $builder) ->setAutowired(NetteApplicationHandler::class) ->addSetup('$catchExceptions', [$this->config->catchExceptions]) ->addSetup('$errorPresenter', [$this->config->errorPresenter]) - ->addSetup('$onResponse[] = ?', [ - (string)(new Nette\PhpGenerator\Literal( - 'function() { Nette\Http\Helpers::initCookie($this->getService(?), $this->getService(?));};', - [$this->prefix('response'), $this->prefix('request')] - )) + ->addSetup('$service->onResponse[] = ?', [ + new Nette\PhpGenerator\Literal( + 'function() { Nette\Http\Helpers::initCookie($this->getService(?), $this->getService(?));}', + [$this->prefix('request'), $this->prefix('response')] + ) ]); }