From 716a4f246127dcd290cae70718038879cdd9e10b Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Sat, 17 Oct 2015 10:57:54 +0200 Subject: [PATCH 1/2] added app_ prefix to form type names --- book/forms.rst | 8 ++++---- cookbook/form/create_custom_field_type.rst | 6 +++--- cookbook/form/create_form_type_extension.rst | 2 +- cookbook/form/dynamic_form_modification.rst | 12 ++++++------ 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/book/forms.rst b/book/forms.rst index a4b95fd62c9..d5c969b8d1c 100644 --- a/book/forms.rst +++ b/book/forms.rst @@ -1066,7 +1066,7 @@ that will house the logic for building the task form:: public function getName() { - return 'task'; + return 'app_task'; } } @@ -1174,7 +1174,7 @@ easy to use in your application. app.form.type.task: class: AppBundle\Form\Type\TaskType tags: - - { name: form.type, alias: task } + - { name: form.type, alias: app_task } .. code-block:: xml @@ -1186,7 +1186,7 @@ easy to use in your application. - + @@ -1200,7 +1200,7 @@ easy to use in your application. 'AppBundle\Form\Type\TaskType' ) ->addTag('form.type', array( - 'alias' => 'task', + 'alias' => 'app_task', )) ; diff --git a/cookbook/form/create_custom_field_type.rst b/cookbook/form/create_custom_field_type.rst index 9a03ef7f501..c49147b8a4c 100644 --- a/cookbook/form/create_custom_field_type.rst +++ b/cookbook/form/create_custom_field_type.rst @@ -308,14 +308,14 @@ the ``genders`` parameter value as the first argument to its to-be-created arguments: - '%genders%' tags: - - { name: form.type, alias: gender } + - { name: form.type, alias: app_gender } .. code-block:: xml %genders% - + .. code-block:: php @@ -329,7 +329,7 @@ the ``genders`` parameter value as the first argument to its to-be-created array('%genders%') )) ->addTag('form.type', array( - 'alias' => 'gender', + 'alias' => 'app_gender', )) ; diff --git a/cookbook/form/create_form_type_extension.rst b/cookbook/form/create_form_type_extension.rst index 153b0b7fc57..39e23350f80 100644 --- a/cookbook/form/create_form_type_extension.rst +++ b/cookbook/form/create_form_type_extension.rst @@ -312,7 +312,7 @@ next to the file field. For example:: public function getName() { - return 'media'; + return 'app_media'; } } diff --git a/cookbook/form/dynamic_form_modification.rst b/cookbook/form/dynamic_form_modification.rst index 006955d9d67..7b5a5d589d2 100644 --- a/cookbook/form/dynamic_form_modification.rst +++ b/cookbook/form/dynamic_form_modification.rst @@ -246,7 +246,7 @@ Using an event listener, your form might look like this:: public function getName() { - return 'friend_message'; + return 'app_friend_message'; } public function setDefaultOptions(OptionsResolverInterface $resolver) @@ -393,7 +393,7 @@ it with :ref:`dic-tags-form-type`. class: AppBundle\Form\Type\FriendMessageFormType arguments: ['@security.context'] tags: - - { name: form.type, alias: friend_message } + - { name: form.type, alias: app_friend_message } .. code-block:: xml @@ -401,7 +401,7 @@ it with :ref:`dic-tags-form-type`. - + @@ -409,7 +409,7 @@ it with :ref:`dic-tags-form-type`. // app/config/config.php $definition = new Definition('AppBundle\Form\Type\FriendMessageFormType'); - $definition->addTag('form.type', array('alias' => 'friend_message')); + $definition->addTag('form.type', array('alias' => 'app_friend_message')); $container->setDefinition( 'app.form.friend_message', $definition, @@ -430,7 +430,7 @@ class, you can simply call:: { public function newAction(Request $request) { - $form = $this->createForm('friend_message'); + $form = $this->createForm('app_friend_message'); // ... } @@ -441,7 +441,7 @@ You can also easily embed the form type into another form:: // inside some other "form type" class public function buildForm(FormBuilderInterface $builder, array $options) { - $builder->add('message', 'friend_message'); + $builder->add('message', 'app_friend_message'); } .. _cookbook-form-events-submitted-data: From e47fa90b977335bc69ea10b60d52c43e6704d91d Mon Sep 17 00:00:00 2001 From: WouterJ Date: Sat, 19 Dec 2015 14:40:06 +0100 Subject: [PATCH 2/2] Updated getName() to return with app_ prefix --- cookbook/form/create_custom_field_type.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/form/create_custom_field_type.rst b/cookbook/form/create_custom_field_type.rst index c49147b8a4c..8a8e0e96e0a 100644 --- a/cookbook/form/create_custom_field_type.rst +++ b/cookbook/form/create_custom_field_type.rst @@ -45,7 +45,7 @@ for form fields, which is ``\Form\Type``. Make sure the field extend public function getName() { - return 'gender'; + return 'app_gender'; } }