Skip to content

Commit eeb52b7

Browse files
committed
minor #6049 Finish #5798 Add app_ prefix to form type names (OskarStark, WouterJ)
This PR was merged into the 2.3 branch. Discussion ---------- Finish #5798 Add app_ prefix to form type names Finishes #5798 Commits ------- e47fa90 Updated getName() to return with app_ prefix 716a4f2 added app_ prefix to form type names
2 parents 1edb61e + e47fa90 commit eeb52b7

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

book/forms.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,7 +1066,7 @@ that will house the logic for building the task form::
10661066

10671067
public function getName()
10681068
{
1069-
return 'task';
1069+
return 'app_task';
10701070
}
10711071
}
10721072

@@ -1174,7 +1174,7 @@ easy to use in your application.
11741174
app.form.type.task:
11751175
class: AppBundle\Form\Type\TaskType
11761176
tags:
1177-
- { name: form.type, alias: task }
1177+
- { name: form.type, alias: app_task }
11781178
11791179
.. code-block:: xml
11801180
@@ -1186,7 +1186,7 @@ easy to use in your application.
11861186
11871187
<services>
11881188
<service id="app.form.type.task" class="AppBundle\Form\Type\TaskType">
1189-
<tag name="form.type" alias="task" />
1189+
<tag name="form.type" alias="app_task" />
11901190
</service>
11911191
</services>
11921192
</container>
@@ -1200,7 +1200,7 @@ easy to use in your application.
12001200
'AppBundle\Form\Type\TaskType'
12011201
)
12021202
->addTag('form.type', array(
1203-
'alias' => 'task',
1203+
'alias' => 'app_task',
12041204
))
12051205
;
12061206

cookbook/form/create_custom_field_type.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ for form fields, which is ``<BundleName>\Form\Type``. Make sure the field extend
4545

4646
public function getName()
4747
{
48-
return 'gender';
48+
return 'app_gender';
4949
}
5050
}
5151

@@ -308,14 +308,14 @@ the ``genders`` parameter value as the first argument to its to-be-created
308308
arguments:
309309
- '%genders%'
310310
tags:
311-
- { name: form.type, alias: gender }
311+
- { name: form.type, alias: app_gender }
312312
313313
.. code-block:: xml
314314
315315
<!-- src/AppBundle/Resources/config/services.xml -->
316316
<service id="app.form.type.gender" class="AppBundle\Form\Type\GenderType">
317317
<argument>%genders%</argument>
318-
<tag name="form.type" alias="gender" />
318+
<tag name="form.type" alias="app_gender" />
319319
</service>
320320
321321
.. code-block:: php
@@ -329,7 +329,7 @@ the ``genders`` parameter value as the first argument to its to-be-created
329329
array('%genders%')
330330
))
331331
->addTag('form.type', array(
332-
'alias' => 'gender',
332+
'alias' => 'app_gender',
333333
))
334334
;
335335

cookbook/form/create_form_type_extension.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ next to the file field. For example::
312312

313313
public function getName()
314314
{
315-
return 'media';
315+
return 'app_media';
316316
}
317317
}
318318

cookbook/form/dynamic_form_modification.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ Using an event listener, your form might look like this::
246246

247247
public function getName()
248248
{
249-
return 'friend_message';
249+
return 'app_friend_message';
250250
}
251251

252252
public function setDefaultOptions(OptionsResolverInterface $resolver)
@@ -393,23 +393,23 @@ it with :ref:`dic-tags-form-type`.
393393
class: AppBundle\Form\Type\FriendMessageFormType
394394
arguments: ['@security.context']
395395
tags:
396-
- { name: form.type, alias: friend_message }
396+
- { name: form.type, alias: app_friend_message }
397397
398398
.. code-block:: xml
399399
400400
<!-- app/config/config.xml -->
401401
<services>
402402
<service id="app.form.friend_message" class="AppBundle\Form\Type\FriendMessageFormType">
403403
<argument type="service" id="security.context" />
404-
<tag name="form.type" alias="friend_message" />
404+
<tag name="form.type" alias="app_friend_message" />
405405
</service>
406406
</services>
407407
408408
.. code-block:: php
409409
410410
// app/config/config.php
411411
$definition = new Definition('AppBundle\Form\Type\FriendMessageFormType');
412-
$definition->addTag('form.type', array('alias' => 'friend_message'));
412+
$definition->addTag('form.type', array('alias' => 'app_friend_message'));
413413
$container->setDefinition(
414414
'app.form.friend_message',
415415
$definition,
@@ -430,7 +430,7 @@ class, you can simply call::
430430
{
431431
public function newAction(Request $request)
432432
{
433-
$form = $this->createForm('friend_message');
433+
$form = $this->createForm('app_friend_message');
434434

435435
// ...
436436
}
@@ -441,7 +441,7 @@ You can also easily embed the form type into another form::
441441
// inside some other "form type" class
442442
public function buildForm(FormBuilderInterface $builder, array $options)
443443
{
444-
$builder->add('message', 'friend_message');
444+
$builder->add('message', 'app_friend_message');
445445
}
446446

447447
.. _cookbook-form-events-submitted-data:

0 commit comments

Comments
 (0)