aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authoradev <adev2000@gmail.com>2017-05-05 00:12:16 +0200
committeradev <adev2000@gmail.com>2017-05-05 00:12:16 +0200
commitab9eb5cdb767510c0c2b9d1b114243741f748f89 (patch)
treee57d1509ea0cb3f38dccc3e9247c065a377d40d7 /src
parent9579003045970d4feed9de955fe939d4f02fe439 (diff)
downloadwallabag-ab9eb5cdb767510c0c2b9d1b114243741f748f89.tar.gz
wallabag-ab9eb5cdb767510c0c2b9d1b114243741f748f89.tar.zst
wallabag-ab9eb5cdb767510c0c2b9d1b114243741f748f89.zip
Fix display the form errors correctly
Use `property_path` form option to map underscored form fields to object properties @see https://github.com/symfony/symfony/issues/9162#issuecomment-25431148 Fix #3067
Diffstat (limited to 'src')
-rw-r--r--src/Wallabag/ApiBundle/Form/Type/ClientType.php6
-rw-r--r--src/Wallabag/CoreBundle/Form/Type/ConfigType.php4
-rw-r--r--src/Wallabag/CoreBundle/Form/Type/EditEntryType.php1
-rw-r--r--src/Wallabag/CoreBundle/Form/Type/RssType.php1
4 files changed, 11 insertions, 1 deletions
diff --git a/src/Wallabag/ApiBundle/Form/Type/ClientType.php b/src/Wallabag/ApiBundle/Form/Type/ClientType.php
index 0ea1a9c5..eaea4feb 100644
--- a/src/Wallabag/ApiBundle/Form/Type/ClientType.php
+++ b/src/Wallabag/ApiBundle/Form/Type/ClientType.php
@@ -16,7 +16,11 @@ class ClientType extends AbstractType
16 { 16 {
17 $builder 17 $builder
18 ->add('name', TextType::class, ['label' => 'developer.client.form.name_label']) 18 ->add('name', TextType::class, ['label' => 'developer.client.form.name_label'])
19 ->add('redirect_uris', UrlType::class, ['required' => false, 'label' => 'developer.client.form.redirect_uris_label']) 19 ->add('redirect_uris', UrlType::class, [
20 'required' => false,
21 'label' => 'developer.client.form.redirect_uris_label',
22 'property_path' => 'redirectUris',
23 ])
20 ->add('save', SubmitType::class, ['label' => 'developer.client.form.save_label']) 24 ->add('save', SubmitType::class, ['label' => 'developer.client.form.save_label'])
21 ; 25 ;
22 26
diff --git a/src/Wallabag/CoreBundle/Form/Type/ConfigType.php b/src/Wallabag/CoreBundle/Form/Type/ConfigType.php
index 7e3b9dd4..1714ce74 100644
--- a/src/Wallabag/CoreBundle/Form/Type/ConfigType.php
+++ b/src/Wallabag/CoreBundle/Form/Type/ConfigType.php
@@ -39,9 +39,11 @@ class ConfigType extends AbstractType
39 ]) 39 ])
40 ->add('items_per_page', null, [ 40 ->add('items_per_page', null, [
41 'label' => 'config.form_settings.items_per_page_label', 41 'label' => 'config.form_settings.items_per_page_label',
42 'property_path' => 'itemsPerPage',
42 ]) 43 ])
43 ->add('reading_speed', ChoiceType::class, [ 44 ->add('reading_speed', ChoiceType::class, [
44 'label' => 'config.form_settings.reading_speed.label', 45 'label' => 'config.form_settings.reading_speed.label',
46 'property_path' => 'readingSpeed',
45 'choices' => [ 47 'choices' => [
46 'config.form_settings.reading_speed.100_word' => '0.5', 48 'config.form_settings.reading_speed.100_word' => '0.5',
47 'config.form_settings.reading_speed.200_word' => '1', 49 'config.form_settings.reading_speed.200_word' => '1',
@@ -51,6 +53,7 @@ class ConfigType extends AbstractType
51 ]) 53 ])
52 ->add('action_mark_as_read', ChoiceType::class, [ 54 ->add('action_mark_as_read', ChoiceType::class, [
53 'label' => 'config.form_settings.action_mark_as_read.label', 55 'label' => 'config.form_settings.action_mark_as_read.label',
56 'property_path' => 'actionMarkAsRead',
54 'choices' => [ 57 'choices' => [
55 'config.form_settings.action_mark_as_read.redirect_homepage' => Config::REDIRECT_TO_HOMEPAGE, 58 'config.form_settings.action_mark_as_read.redirect_homepage' => Config::REDIRECT_TO_HOMEPAGE,
56 'config.form_settings.action_mark_as_read.redirect_current_page' => Config::REDIRECT_TO_CURRENT_PAGE, 59 'config.form_settings.action_mark_as_read.redirect_current_page' => Config::REDIRECT_TO_CURRENT_PAGE,
@@ -61,6 +64,7 @@ class ConfigType extends AbstractType
61 'label' => 'config.form_settings.language_label', 64 'label' => 'config.form_settings.language_label',
62 ]) 65 ])
63 ->add('pocket_consumer_key', null, [ 66 ->add('pocket_consumer_key', null, [
67 'property_path' => 'pocketConsumerKey',
64 'label' => 'config.form_settings.pocket_consumer_key_label', 68 'label' => 'config.form_settings.pocket_consumer_key_label',
65 ]) 69 ])
66 ->add('save', SubmitType::class, [ 70 ->add('save', SubmitType::class, [
diff --git a/src/Wallabag/CoreBundle/Form/Type/EditEntryType.php b/src/Wallabag/CoreBundle/Form/Type/EditEntryType.php
index 40e5b5b9..c3715646 100644
--- a/src/Wallabag/CoreBundle/Form/Type/EditEntryType.php
+++ b/src/Wallabag/CoreBundle/Form/Type/EditEntryType.php
@@ -21,6 +21,7 @@ class EditEntryType extends AbstractType
21 ->add('is_public', CheckboxType::class, [ 21 ->add('is_public', CheckboxType::class, [
22 'required' => false, 22 'required' => false,
23 'label' => 'entry.edit.is_public_label', 23 'label' => 'entry.edit.is_public_label',
24 'property_path' => 'isPublic',
24 ]) 25 ])
25 ->add('url', TextType::class, [ 26 ->add('url', TextType::class, [
26 'disabled' => true, 27 'disabled' => true,
diff --git a/src/Wallabag/CoreBundle/Form/Type/RssType.php b/src/Wallabag/CoreBundle/Form/Type/RssType.php
index 94324fed..49b31c1e 100644
--- a/src/Wallabag/CoreBundle/Form/Type/RssType.php
+++ b/src/Wallabag/CoreBundle/Form/Type/RssType.php
@@ -14,6 +14,7 @@ class RssType extends AbstractType
14 $builder 14 $builder
15 ->add('rss_limit', null, [ 15 ->add('rss_limit', null, [
16 'label' => 'config.form_rss.rss_limit', 16 'label' => 'config.form_rss.rss_limit',
17 'property_path' => 'rssLimit',
17 ]) 18 ])
18 ->add('save', SubmitType::class, [ 19 ->add('save', SubmitType::class, [
19 'label' => 'config.form.save', 20 'label' => 'config.form.save',