Skip to content

Commit 3fa821a

Browse files
committed
added app_ prefix to form type names
1 parent b785d35 commit 3fa821a

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

book/forms.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -1068,7 +1068,7 @@ that will house the logic for building the task form::
10681068

10691069
public function getName()
10701070
{
1071-
return 'task';
1071+
return 'app_task';
10721072
}
10731073
}
10741074

@@ -1176,7 +1176,7 @@ easy to use in your application.
11761176
app.form.type.task:
11771177
class: AppBundle\Form\Type\TaskType
11781178
tags:
1179-
- { name: form.type, alias: task }
1179+
- { name: form.type, alias: app_task }
11801180
11811181
.. code-block:: xml
11821182
@@ -1188,7 +1188,7 @@ easy to use in your application.
11881188
11891189
<services>
11901190
<service id="app.form.type.task" class="AppBundle\Form\Type\TaskType">
1191-
<tag name="form.type" alias="task" />
1191+
<tag name="form.type" alias="app_task" />
11921192
</service>
11931193
</services>
11941194
</container>
@@ -1202,7 +1202,7 @@ easy to use in your application.
12021202
'AppBundle\Form\Type\TaskType'
12031203
)
12041204
->addTag('form.type', array(
1205-
'alias' => 'task',
1205+
'alias' => 'app_task',
12061206
))
12071207
;
12081208

cookbook/form/create_custom_field_type.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -311,14 +311,14 @@ the ``genders`` parameter value as the first argument to its to-be-created
311311
arguments:
312312
- "%genders%"
313313
tags:
314-
- { name: form.type, alias: gender }
314+
- { name: form.type, alias: app_gender }
315315
316316
.. code-block:: xml
317317
318318
<!-- src/AppBundle/Resources/config/services.xml -->
319319
<service id="app.form.type.gender" class="AppBundle\Form\Type\GenderType">
320320
<argument>%genders%</argument>
321-
<tag name="form.type" alias="gender" />
321+
<tag name="form.type" alias="app_gender" />
322322
</service>
323323
324324
.. code-block:: php
@@ -332,7 +332,7 @@ the ``genders`` parameter value as the first argument to its to-be-created
332332
array('%genders%')
333333
))
334334
->addTag('form.type', array(
335-
'alias' => 'gender',
335+
'alias' => 'app_gender',
336336
))
337337
;
338338

cookbook/form/create_form_type_extension.rst

+1-1
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

+7-7
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ Using an event listener, your form might look like this::
240240

241241
public function getName()
242242
{
243-
return 'friend_message';
243+
return 'app_friend_message';
244244
}
245245
}
246246

@@ -388,23 +388,23 @@ it with :ref:`dic-tags-form-type`.
388388
class: AppBundle\Form\Type\FriendMessageFormType
389389
arguments: ["@security.token_storage"]
390390
tags:
391-
- { name: form.type, alias: friend_message }
391+
- { name: form.type, alias: app_friend_message }
392392
393393
.. code-block:: xml
394394
395395
<!-- app/config/config.xml -->
396396
<services>
397397
<service id="app.form.friend_message" class="AppBundle\Form\Type\FriendMessageFormType">
398398
<argument type="service" id="security.token_storage" />
399-
<tag name="form.type" alias="friend_message" />
399+
<tag name="form.type" alias="app_friend_message" />
400400
</service>
401401
</services>
402402
403403
.. code-block:: php
404404
405405
// app/config/config.php
406406
$definition = new Definition('AppBundle\Form\Type\FriendMessageFormType');
407-
$definition->addTag('form.type', array('alias' => 'friend_message'));
407+
$definition->addTag('form.type', array('alias' => 'app_friend_message'));
408408
$container->setDefinition(
409409
'app.form.friend_message',
410410
$definition,
@@ -420,22 +420,22 @@ access to the form factory, you then use::
420420
{
421421
public function newAction(Request $request)
422422
{
423-
$form = $this->get('form.factory')->create('friend_message');
423+
$form = $this->get('form.factory')->create('app_friend_message');
424424

425425
// ...
426426
}
427427
}
428428

429429
If you extend the ``Symfony\Bundle\FrameworkBundle\Controller\Controller`` class, you can simply call::
430430

431-
$form = $this->createForm('friend_message');
431+
$form = $this->createForm('app_friend_message');
432432

433433
You can also easily embed the form type into another form::
434434

435435
// inside some other "form type" class
436436
public function buildForm(FormBuilderInterface $builder, array $options)
437437
{
438-
$builder->add('message', 'friend_message');
438+
$builder->add('message', 'app_friend_message');
439439
}
440440

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

0 commit comments

Comments
 (0)