aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Form
diff options
context:
space:
mode:
Diffstat (limited to 'src/Wallabag/CoreBundle/Form')
-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 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;
13use Symfony\Component\Form\FormBuilderInterface; 13use Symfony\Component\Form\FormBuilderInterface;
14use Symfony\Component\HttpFoundation\Response; 14use Symfony\Component\HttpFoundation\Response;
15use Symfony\Component\OptionsResolver\OptionsResolver; 15use Symfony\Component\OptionsResolver\OptionsResolver;
16use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage; 16use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
17 17
18class EntryFilterType extends AbstractType 18class EntryFilterType extends AbstractType
19{ 19{
@@ -23,13 +23,18 @@ class EntryFilterType extends AbstractType
23 /** 23 /**
24 * Repository & user are used to get a list of language entries for this user. 24 * Repository & user are used to get a list of language entries for this user.
25 * 25 *
26 * @param EntityRepository $entryRepository 26 * @param EntityRepository $entryRepository
27 * @param TokenStorage $token 27 * @param TokenStorageInterface $tokenStorage
28 */ 28 */
29 public function __construct(EntityRepository $entryRepository, TokenStorage $token) 29 public function __construct(EntityRepository $entryRepository, TokenStorageInterface $tokenStorage)
30 { 30 {
31 $this->repository = $entryRepository; 31 $this->repository = $entryRepository;
32 $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 }
33 } 38 }
34 39
35 public function buildForm(FormBuilderInterface $builder, array $options) 40 public function buildForm(FormBuilderInterface $builder, array $options)