Skip to content

Commit 1e78371

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

File tree

4 files changed

+23
-23
lines changed

4 files changed

+23
-23
lines changed

book/forms.rst

Lines changed: 6 additions & 6 deletions
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

@@ -1173,7 +1173,7 @@ easy to use in your application.
11731173
11741174
# src/AppBundle/Resources/config/services.yml
11751175
services:
1176-
app.form.type.task:
1176+
app.form.type.app_task:
11771177
class: AppBundle\Form\Type\TaskType
11781178
tags:
11791179
- { name: form.type, alias: task }
@@ -1187,8 +1187,8 @@ easy to use in your application.
11871187
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
11881188
11891189
<services>
1190-
<service id="app.form.type.task" class="AppBundle\Form\Type\TaskType">
1191-
<tag name="form.type" alias="task" />
1190+
<service id="app.form.type.app_task" class="AppBundle\Form\Type\TaskType">
1191+
<tag name="form.type" alias="app_task" />
11921192
</service>
11931193
</services>
11941194
</container>
@@ -1198,11 +1198,11 @@ easy to use in your application.
11981198
// src/AppBundle/Resources/config/services.php
11991199
$container
12001200
->register(
1201-
'app.form.type.task',
1201+
'app.form.type.app_task',
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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -306,19 +306,19 @@ the ``genders`` parameter value as the first argument to its to-be-created
306306
307307
# src/AppBundle/Resources/config/services.yml
308308
services:
309-
app.form.type.gender:
309+
app.form.type.app_gender:
310310
class: AppBundle\Form\Type\GenderType
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 -->
319-
<service id="app.form.type.gender" class="AppBundle\Form\Type\GenderType">
319+
<service id="app.form.type.app_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
@@ -327,12 +327,12 @@ the ``genders`` parameter value as the first argument to its to-be-created
327327
use Symfony\Component\DependencyInjection\Definition;
328328
329329
$container
330-
->setDefinition('app.form.type.gender', new Definition(
330+
->setDefinition('app.form.type.app_gender', new Definition(
331331
'AppBundle\Form\Type\GenderType',
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

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: 10 additions & 10 deletions
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

@@ -384,29 +384,29 @@ it with :ref:`dic-tags-form-type`.
384384
385385
# app/config/config.yml
386386
services:
387-
app.form.friend_message:
387+
app.form.app_friend_message:
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>
397-
<service id="app.form.friend_message" class="AppBundle\Form\Type\FriendMessageFormType">
397+
<service id="app.form.app_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(
409-
'app.form.friend_message',
409+
'app.form.app_friend_message',
410410
$definition,
411411
array('security.token_storage')
412412
);
@@ -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)