aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php')
-rw-r--r--src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php15
1 files changed, 10 insertions, 5 deletions
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;
12use Symfony\Component\Form\AbstractType; 12use Symfony\Component\Form\AbstractType;
13use Symfony\Component\Form\FormBuilderInterface; 13use Symfony\Component\Form\FormBuilderInterface;
14use Symfony\Component\OptionsResolver\OptionsResolver; 14use Symfony\Component\OptionsResolver\OptionsResolver;
15use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage; 15use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
16 16
17class EntryFilterType extends AbstractType 17class EntryFilterType extends AbstractType
18{ 18{
@@ -22,13 +22,18 @@ class EntryFilterType extends AbstractType
22 /** 22 /**
23 * Repository & user are used to get a list of language entries for this user. 23 * Repository & user are used to get a list of language entries for this user.
24 * 24 *
25 * @param EntityRepository $entryRepository 25 * @param EntityRepository $entryRepository
26 * @param TokenStorage $token 26 * @param TokenStorageInterface $tokenStorage
27 */ 27 */
28 public function __construct(EntityRepository $entryRepository, TokenStorage $token) 28 public function __construct(EntityRepository $entryRepository, TokenStorageInterface $tokenStorage)
29 { 29 {
30 $this->repository = $entryRepository; 30 $this->repository = $entryRepository;
31 $this->user = $token->getToken()->getUser(); 31
32 $this->user = $tokenStorage->getToken() ? $tokenStorage->getToken()->getUser() : null;
33
34 if (null === $this->user || !is_object($this->user)) {
35 return null;
36 }
32 } 37 }
33 38
34 public function buildForm(FormBuilderInterface $builder, array $options) 39 public function buildForm(FormBuilderInterface $builder, array $options)