diff options
Diffstat (limited to 'src/Wallabag/CoreBundle/Form')
-rw-r--r-- | src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php | 10 |
1 files changed, 8 insertions, 2 deletions
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; | |||
13 | use Symfony\Component\Form\FormBuilderInterface; | 13 | use Symfony\Component\Form\FormBuilderInterface; |
14 | use Symfony\Component\OptionsResolver\OptionsResolver; | 14 | use Symfony\Component\OptionsResolver\OptionsResolver; |
15 | use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage; | 15 | use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage; |
16 | use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; | ||
16 | 17 | ||
17 | class EntryFilterType extends AbstractType | 18 | class EntryFilterType extends AbstractType |
18 | { | 19 | { |
@@ -25,10 +26,15 @@ class EntryFilterType extends AbstractType | |||
25 | * @param EntityRepository $entryRepository | 26 | * @param EntityRepository $entryRepository |
26 | * @param TokenStorage $token | 27 | * @param TokenStorage $token |
27 | */ | 28 | */ |
28 | public function __construct(EntityRepository $entryRepository, TokenStorage $token) | 29 | public function __construct(EntityRepository $entryRepository, TokenStorageInterface $tokenStorage) |
29 | { | 30 | { |
30 | $this->repository = $entryRepository; | 31 | $this->repository = $entryRepository; |
31 | $this->user = $token->getToken()->getUser(); | 32 | |
33 | $this->user = $tokenStorage->getToken() ? $tokenStorage->getToken()->getUser() : null; | ||
34 | |||
35 | if (null === $this->user || !is_object($this->user)) { | ||
36 | return null; | ||
37 | } | ||
32 | } | 38 | } |
33 | 39 | ||
34 | public function buildForm(FormBuilderInterface $builder, array $options) | 40 | public function buildForm(FormBuilderInterface $builder, array $options) |