X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FCoreBundle%2FForm%2FType%2FEntryFilterType.php;h=a3e36fddd344304ed9c5630a38a905fba27f8bf8;hb=94766a89627df74449b9e34d31a06db386a1b07a;hp=3c597b5db51a44af1619364297776df744c8ef3c;hpb=f49d9ca383c9f8a1bc426cfabf6b1cea53ea26b4;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..a3e36fdd 100644 --- a/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php +++ b/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php @@ -12,7 +12,7 @@ use Lexik\Bundle\FormFilterBundle\Filter\Form\Type\ChoiceFilterType; 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 { @@ -22,13 +22,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)