Skip to content

Added docs about ArgumentValueResolvers #6438

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Prev Previous commit
Next Next commit
Fixed the tag name
  • Loading branch information
Iltar van der Berg committed Apr 29, 2016
commit 9784406850e1a35d6aca3b189292830f7c10e8dc
6 changes: 3 additions & 3 deletions cookbook/controller/argument_value_resolver.rst
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ and adding a priority.
arguments:
- '@security.token_storage'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

" instead of ' ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using single quotes is better in Yaml

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be curious for the reason: not that I don't agree with it but I always thought there was absolutely not difference. Besides it's quite inconsistent (or at least used to be I didn't check for a while now) in Symfony/Symfony docs.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here you can find more details about single/double quotes: http://symfony.com/doc/current/components/yaml/yaml_format.html

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@javiereguiluz my comment was maybe a bit misleading: I'm aware of the differences, I was only talking for when both were giving the same result as why to pick simple quotes over double ones.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@theofidry the link actually says:

Strings containing any of the following characters must be quoted. Although you can use double quotes, for these characters it is more convenient to use single quotes, which avoids having to escape any backslash \

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@theofidry we recently updated most double quotes in Yaml to single quotes (for consistency).

Using double quotes (or advocating using them) leads to problems with certain strings that are valid in PHP double quotes. For instance, "AppBundle\Controller\StaticController" is a valid PHP value, but it would result in a parser error in Yaml as \C and \S are not valid character sequences.

tags:
- { name: controller_argument.value_resolver, priority: 50 }
- { name: controller.argument_value_resolver, priority: 50 }

.. code-block:: xml

Expand All @@ -187,7 +187,7 @@ and adding a priority.
<services>
<service id="app.value_resolver.user" class="AppBundle\ArgumentValueResolver\UserValueResolver">
<argument type="service" id="security.token_storage">
<tag name="controller_argument.value_resolver" priority="50" />
<tag name="controller.argument_value_resolver" priority="50" />
</service>
</services>

Expand All @@ -202,7 +202,7 @@ and adding a priority.
'AppBundle\ArgumentValueResolver\UserValueResolver',
array(new Reference('security.token_storage'))
);
$definition->addTag('controller_argument.value_resolver', array('priority' => 50));
$definition->addTag('controller.argument_value_resolver', array('priority' => 50));
$container->setDefinition('app.value_resolver.user', $definition);

.. _`yield`: http://php.net/manual/en/language.generators.syntax.php
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy