markitosgv / JWTRefreshTokenBundle

Implements a Refresh Token system over Json Web Tokens in Symfony
MIT License
663 stars 158 forks source link

Undefined method 'findInvalid'. The method name must start with either findBy, findOneBy or countBy! #215

Open ciklum-bohdan opened 3 years ago

ciklum-bohdan commented 3 years ago

When I run

bin/console gesdinet:jwt:clear -v 

I get an error


In EntityRepository.php line 235:

  [BadMethodCallException]                                                                              
  Undefined method 'findInvalid'. The method name must start with either findBy, findOneBy or countBy!  

Exception trace:
  at /projects/api-members/vendor/doctrine/orm/lib/Doctrine/ORM/EntityRepository.php:235
 Doctrine\ORM\EntityRepository->__call() at /projects/api-members/vendor/gesdinet/jwt-refresh-token-bundle/Doctrine/RefreshTokenManager.php:104
 Gesdinet\JWTRefreshTokenBundle\Doctrine\RefreshTokenManager->revokeAllInvalid() at /projects/api-members/vendor/gesdinet/jwt-refresh-token-bundle/Command/ClearInvalidRefreshTokensCommand.php:59
 Gesdinet\JWTRefreshTokenBundle\Command\ClearInvalidRefreshTokensCommand->execute() at /projects/api-members/vendor/symfony/console/Command/Command.php:255
 Symfony\Component\Console\Command\Command->run() at /projects/api-members/vendor/symfony/console/Application.php:1018
 Symfony\Component\Console\Application->doRunCommand() at /projects/api-members/vendor/symfony/framework-bundle/Console/Application.php:97
 Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand() at /projects/api-members/vendor/symfony/console/Application.php:271
 Symfony\Component\Console\Application->doRun() at /projects/api-members/vendor/symfony/framework-bundle/Console/Application.php:83
 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /projects/api-members/vendor/symfony/console/Application.php:147
 Symfony\Component\Console\Application->run() at /projects/api-members/bin/console:42

gesdinet:jwt:clear [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <command> [<datetime>]
piciuok commented 3 years ago

image

You must just define repository like above - i had same problem ;)

piotrkreft commented 3 years ago

@markitosgv Perhaps worth adding interface implementing findInvalid method and checking retrieved from ObjectManager instance for a clear exception message?