improve exception message if symfony/security-csrf is missing

This commit is contained in:
Christian Flothmann 2021-02-26 11:19:16 +01:00
parent a5683c5324
commit 1a26ed43e7

View File

@ -59,7 +59,7 @@ class FormRenderer implements FormRendererInterface
public function renderCsrfToken($tokenId) public function renderCsrfToken($tokenId)
{ {
if (null === $this->csrfTokenManager) { if (null === $this->csrfTokenManager) {
throw new BadMethodCallException('CSRF tokens can only be generated if a CsrfTokenManagerInterface is injected in FormRenderer::__construct().'); throw new BadMethodCallException('CSRF tokens can only be generated if a CsrfTokenManagerInterface is injected in FormRenderer::__construct(). Try running "composer require symfony/security-csrf".');
} }
return $this->csrfTokenManager->getToken($tokenId)->getValue(); return $this->csrfTokenManager->getToken($tokenId)->getValue();