X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FCoreBundle%2FForm%2FType%2FEntryFilterType.php;h=f7fbd2ecfc8ef1db0ed4d868c2b272e2656a5977;hb=2fe2e411a74d541ddd7eee2aca1b80ac58de49eb;hp=3c597b5db51a44af1619364297776df744c8ef3c;hpb=24692715de6be93d3d01606624003cef4d170133;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php b/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php index 3c597b5d..f7fbd2ec 100644 --- a/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php +++ b/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php @@ -13,6 +13,7 @@ use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage; +use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; class EntryFilterType extends AbstractType { @@ -25,10 +26,15 @@ class EntryFilterType extends AbstractType * @param EntityRepository $entryRepository * @param TokenStorage $token */ - public function __construct(EntityRepository $entryRepository, TokenStorage $token) + public function __construct(EntityRepository $entryRepository, TokenStorageInterface $tokenStorage) { $this->repository = $entryRepository; - $this->user = $token->getToken()->getUser(); + + $this->user = $tokenStorage->getToken() ? $tokenStorage->getToken()->getUser() : null; + + if (null === $this->user || !is_object($this->user)) { + return null; + } } public function buildForm(FormBuilderInterface $builder, array $options)