]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
Fix display the form errors correctly 3082/head
authoradev <adev2000@gmail.com>
Thu, 4 May 2017 22:12:16 +0000 (00:12 +0200)
committeradev <adev2000@gmail.com>
Thu, 4 May 2017 22:12:16 +0000 (00:12 +0200)
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

src/Wallabag/ApiBundle/Form/Type/ClientType.php
src/Wallabag/CoreBundle/Form/Type/ConfigType.php
src/Wallabag/CoreBundle/Form/Type/EditEntryType.php
src/Wallabag/CoreBundle/Form/Type/RssType.php

index 0ea1a9c5c6469c60c4126ba5773cf1172d4a7894..eaea4febe2c17d3550d8eccd4e5a84233ecf2ede 100644 (file)
@@ -16,7 +16,11 @@ class ClientType extends AbstractType
     {
         $builder
             ->add('name', TextType::class, ['label' => 'developer.client.form.name_label'])
-            ->add('redirect_uris', UrlType::class, ['required' => false, 'label' => 'developer.client.form.redirect_uris_label'])
+            ->add('redirect_uris', UrlType::class, [
+                'required' => false,
+                'label' => 'developer.client.form.redirect_uris_label',
+                'property_path' => 'redirectUris',
+            ])
             ->add('save', SubmitType::class, ['label' => 'developer.client.form.save_label'])
         ;
 
index 7e3b9dd4f93ce52c0ba523605b03b0f86aef0c0f..1714ce74aa549e2cdddcb9f231dc946148e0a75f 100644 (file)
@@ -39,9 +39,11 @@ class ConfigType extends AbstractType
             ])
             ->add('items_per_page', null, [
                 'label' => 'config.form_settings.items_per_page_label',
+                'property_path' => 'itemsPerPage',
             ])
             ->add('reading_speed', ChoiceType::class, [
                 'label' => 'config.form_settings.reading_speed.label',
+                'property_path' => 'readingSpeed',
                 'choices' => [
                     'config.form_settings.reading_speed.100_word' => '0.5',
                     'config.form_settings.reading_speed.200_word' => '1',
@@ -51,6 +53,7 @@ class ConfigType extends AbstractType
             ])
             ->add('action_mark_as_read', ChoiceType::class, [
                 'label' => 'config.form_settings.action_mark_as_read.label',
+                'property_path' => 'actionMarkAsRead',
                 'choices' => [
                     'config.form_settings.action_mark_as_read.redirect_homepage' => Config::REDIRECT_TO_HOMEPAGE,
                     'config.form_settings.action_mark_as_read.redirect_current_page' => Config::REDIRECT_TO_CURRENT_PAGE,
@@ -61,6 +64,7 @@ class ConfigType extends AbstractType
                 'label' => 'config.form_settings.language_label',
             ])
             ->add('pocket_consumer_key', null, [
+                'property_path' => 'pocketConsumerKey',
                 'label' => 'config.form_settings.pocket_consumer_key_label',
             ])
             ->add('save', SubmitType::class, [
index 40e5b5b9a2cd88e120cd32a96cf0ddbb71208a08..c37156465314d39d602724fadd7b50c41258730f 100644 (file)
@@ -21,6 +21,7 @@ class EditEntryType extends AbstractType
             ->add('is_public', CheckboxType::class, [
                 'required' => false,
                 'label' => 'entry.edit.is_public_label',
+                'property_path' => 'isPublic',
             ])
             ->add('url', TextType::class, [
                 'disabled' => true,
index 94324fed6d31459e27db3eeceb24dd63ae68d276..49b31c1e2f9abd2d548dd2d69adabc218612047a 100644 (file)
@@ -14,6 +14,7 @@ class RssType extends AbstractType
         $builder
             ->add('rss_limit', null, [
                 'label' => 'config.form_rss.rss_limit',
+                'property_path' => 'rssLimit',
             ])
             ->add('save', SubmitType::class, [
                 'label' => 'config.form.save',