X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FCoreBundle%2FForm%2FType%2FEntryFilterType.php;h=7b02f85c35e336671d3ee19f87f22ef8be677aec;hb=ebe50a85fbf3ce6b83efa7da191e10cd30edb07c;hp=8e2883f766a5614ffe5a0ed449e33c9e20dd2c17;hpb=bbd4ae7b56d9db744482a5630abad350f2d819af;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php b/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php index 8e2883f7..7b02f85c 100644 --- a/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php +++ b/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php @@ -13,7 +13,7 @@ use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\HttpFoundation\Response; 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 { @@ -23,13 +23,18 @@ class EntryFilterType extends AbstractType /** * Repository & user are used to get a list of language entries for this user. * - * @param EntityRepository $entryRepository - * @param TokenStorage $token + * @param EntityRepository $entryRepository + * @param TokenStorageInterface $tokenStorage */ - 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)