diff options
author | Jeremy Benoist <jeremy.benoist@gmail.com> | 2016-01-09 18:38:40 +0100 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2016-01-15 09:35:38 +0100 |
commit | 1d76102a240c2596832848128a7b9cf5aa2050dd (patch) | |
tree | ba6d7a1b4d5d763ae5bce41fcb9395b7f8b5c5f3 /src/Wallabag/CoreBundle | |
parent | 8ba854c068f541039d81524d171769b6e1220171 (diff) | |
download | wallabag-1d76102a240c2596832848128a7b9cf5aa2050dd.tar.gz wallabag-1d76102a240c2596832848128a7b9cf5aa2050dd.tar.zst wallabag-1d76102a240c2596832848128a7b9cf5aa2050dd.zip |
Fix recent update
- some missing url parameters from WallabagRestController & EntryController
- use a service for `EntryFilterType` to use fully qualified name instead (so changing class signature)
- update ImportBundle (url & form)
Diffstat (limited to 'src/Wallabag/CoreBundle')
4 files changed, 20 insertions, 12 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index 83e5b57d..dda0a456 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php | |||
@@ -234,7 +234,7 @@ class EntryController extends Controller | |||
234 | throw new \InvalidArgumentException(sprintf('Type "%s" is not implemented.', $type)); | 234 | throw new \InvalidArgumentException(sprintf('Type "%s" is not implemented.', $type)); |
235 | } | 235 | } |
236 | 236 | ||
237 | $form = $this->createForm(new EntryFilterType($repository, $this->getUser())); | 237 | $form = $this->createForm(EntryFilterType::class); |
238 | 238 | ||
239 | if ($request->query->has($form->getName())) { | 239 | if ($request->query->has($form->getName())) { |
240 | // manually bind values from the request | 240 | // manually bind values from the request |
diff --git a/src/Wallabag/CoreBundle/Filter/EntryFilterType.php b/src/Wallabag/CoreBundle/Filter/EntryFilterType.php index 4430c971..c38be832 100644 --- a/src/Wallabag/CoreBundle/Filter/EntryFilterType.php +++ b/src/Wallabag/CoreBundle/Filter/EntryFilterType.php | |||
@@ -12,7 +12,7 @@ use Lexik\Bundle\FormFilterBundle\Filter\Form\Type\ChoiceFilterType; | |||
12 | use Symfony\Component\Form\AbstractType; | 12 | 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 Wallabag\UserBundle\Entity\User; | 15 | use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage; |
16 | 16 | ||
17 | class EntryFilterType extends AbstractType | 17 | class EntryFilterType extends AbstractType |
18 | { | 18 | { |
@@ -23,12 +23,12 @@ class EntryFilterType extends AbstractType | |||
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 User $user | 26 | * @param TokenStorage $token |
27 | */ | 27 | */ |
28 | public function __construct(EntityRepository $entryRepository, User $user) | 28 | public function __construct(EntityRepository $entryRepository, TokenStorage $token) |
29 | { | 29 | { |
30 | $this->repository = $entryRepository; | 30 | $this->repository = $entryRepository; |
31 | $this->user = $user; | 31 | $this->user = $token->getToken()->getUser(); |
32 | } | 32 | } |
33 | 33 | ||
34 | public function buildForm(FormBuilderInterface $builder, array $options) | 34 | public function buildForm(FormBuilderInterface $builder, array $options) |
@@ -54,13 +54,13 @@ class EntryFilterType extends AbstractType | |||
54 | ) | 54 | ) |
55 | ->add('domainName', TextFilterType::class, array( | 55 | ->add('domainName', TextFilterType::class, array( |
56 | 'apply_filter' => function (QueryInterface $filterQuery, $field, $values) { | 56 | 'apply_filter' => function (QueryInterface $filterQuery, $field, $values) { |
57 | $value = $values['value']; | 57 | $value = $values['value']; |
58 | if (strlen($value) <= 2 || empty($value)) { | 58 | if (strlen($value) <= 2 || empty($value)) { |
59 | return; | 59 | return; |
60 | } | 60 | } |
61 | $expression = $filterQuery->getExpr()->like($field, $filterQuery->getExpr()->literal('%'.$value.'%')); | 61 | $expression = $filterQuery->getExpr()->like($field, $filterQuery->getExpr()->literal('%'.$value.'%')); |
62 | 62 | ||
63 | return $filterQuery->createCondition($expression); | 63 | return $filterQuery->createCondition($expression); |
64 | }, | 64 | }, |
65 | )) | 65 | )) |
66 | ->add('isArchived', CheckboxFilterType::class) | 66 | ->add('isArchived', CheckboxFilterType::class) |
diff --git a/src/Wallabag/CoreBundle/Form/Type/UserInformationType.php b/src/Wallabag/CoreBundle/Form/Type/UserInformationType.php index f52e409a..f491b0ae 100644 --- a/src/Wallabag/CoreBundle/Form/Type/UserInformationType.php +++ b/src/Wallabag/CoreBundle/Form/Type/UserInformationType.php | |||
@@ -26,7 +26,7 @@ class UserInformationType extends AbstractType | |||
26 | 26 | ||
27 | public function getParent() | 27 | public function getParent() |
28 | { | 28 | { |
29 | return 'fos_user_registration'; | 29 | return 'FOS\UserBundle\Form\Type\RegistrationFormType'; |
30 | } | 30 | } |
31 | 31 | ||
32 | public function configureOptions(OptionsResolver $resolver) | 32 | public function configureOptions(OptionsResolver $resolver) |
diff --git a/src/Wallabag/CoreBundle/Resources/config/services.yml b/src/Wallabag/CoreBundle/Resources/config/services.yml index e8dafc5d..43600735 100644 --- a/src/Wallabag/CoreBundle/Resources/config/services.yml +++ b/src/Wallabag/CoreBundle/Resources/config/services.yml | |||
@@ -14,6 +14,14 @@ services: | |||
14 | tags: | 14 | tags: |
15 | - { name: form.type } | 15 | - { name: form.type } |
16 | 16 | ||
17 | wallabag_core.filter.type.entry: | ||
18 | class: Wallabag\CoreBundle\Filter\EntryFilterType | ||
19 | arguments: | ||
20 | - "@wallabag_core.entry_repository" | ||
21 | - "@security.token_storage" | ||
22 | tags: | ||
23 | - { name: form.type } | ||
24 | |||
17 | wallabag_core.param_converter.username_rsstoken_converter: | 25 | wallabag_core.param_converter.username_rsstoken_converter: |
18 | class: Wallabag\CoreBundle\ParamConverter\UsernameRssTokenConverter | 26 | class: Wallabag\CoreBundle\ParamConverter\UsernameRssTokenConverter |
19 | tags: | 27 | tags: |