Skip to content

Commit

Permalink
minor #4881 Remove 'acme' (ifdattic)
Browse files Browse the repository at this point in the history
This PR was squashed before being merged into the 2.3 branch (closes #4881).

Discussion
----------

Remove 'acme'

| Q             | A
| ------------- | ---
| Doc fix?      | yes
| New docs?     | no
| Applies to    | 2.3
| Fixed tickets |

Commits
-------

f76ff18 Remove 'acme'
  • Loading branch information
wouterj committed Jan 23, 2015
2 parents 6a15077 + f76ff18 commit 3774a37
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions cookbook/form/dynamic_form_modification.rst
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ Using an event listener, your form might look like this::

public function getName()
{
return 'acme_friend_message';
return 'friend_message';
}

public function setDefaultOptions(OptionsResolverInterface $resolver)
Expand Down Expand Up @@ -389,29 +389,29 @@ it with :ref:`dic-tags-form-type`.
# app/config/config.yml
services:
acme.form.friend_message:
app.form.friend_message:
class: AppBundle\Form\Type\FriendMessageFormType
arguments: ["@security.context"]
tags:
- { name: form.type, alias: acme_friend_message }
- { name: form.type, alias: friend_message }
.. code-block:: xml
<!-- app/config/config.xml -->
<services>
<service id="acme.form.friend_message" class="AppBundle\Form\Type\FriendMessageFormType">
<service id="app.form.friend_message" class="AppBundle\Form\Type\FriendMessageFormType">
<argument type="service" id="security.context" />
<tag name="form.type" alias="acme_friend_message" />
<tag name="form.type" alias="friend_message" />
</service>
</services>
.. code-block:: php
// app/config/config.php
$definition = new Definition('AppBundle\Form\Type\FriendMessageFormType');
$definition->addTag('form.type', array('alias' => 'acme_friend_message'));
$definition->addTag('form.type', array('alias' => 'friend_message'));
$container->setDefinition(
'acme.form.friend_message',
'app.form.friend_message',
$definition,
array('security.context')
);
Expand All @@ -425,22 +425,22 @@ access to the form factory, you then use::
{
public function newAction(Request $request)
{
$form = $this->get('form.factory')->create('acme_friend_message');
$form = $this->get('form.factory')->create('friend_message');

// ...
}
}

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

$form = $this->createForm('acme_friend_message');
$form = $this->createForm('friend_message');

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', 'acme_friend_message');
$builder->add('message', 'friend_message');
}

.. _cookbook-form-events-submitted-data:
Expand Down

0 comments on commit 3774a37

Please sign in to comment.