minor #40314 improve exception message if symfony/security-csrf is missing (xabbuh)
This PR was merged into the 4.4 branch.
Discussion
----------
improve exception message if symfony/security-csrf is missing
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Tickets | Fix #37452
| License | MIT
| Doc PR |
Commits
-------
1a26ed43e7
improve exception message if symfony/security-csrf is missing
This commit is contained in:
commit
b3c4d639dd
@ -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();
|
||||||
|
Reference in New Issue
Block a user