I am learning Symfony 4 and trying to use is_granted method in twig but unfortunately it return errors:
HTTP 500 Internal Server Error
Argument 4 passed to Symfony\Component\Security\Core\Event\VoteEvent::__construct() must be of the type int, null given, called in /var/www/vendor/symfony/security-core/Authorization/Voter/TraceableVoter.php on line 41
Here is my code
{% if is_granted('ROLE_USER') %}
{% endif %}
I have no knowledge with voter yet but want to use is_granted method only? what is the problem here?
Any help would be extremely appreciated?
There is a similar point here: http://github.com/symfony/symfony/issues/30675 A Voter's
vote()
method did not have a areturn
, which is used to create aVoteEvent
.