-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[DependencyInjection] Add normalization to tag options #9489
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
Conversation
if (false !== strpos($name, '-') && false === strpos($name, '_') && !array_key_exists($normalizedName = str_replace('-', '_', $name), $parameters)) { | ||
$parameters[$normalizedName] = SimpleXMLElement::phpize($value); | ||
} | ||
// keep not normalized key for BC too |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line break?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line break?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i guess that piece of logic goes together with the one below
Can you add a unit test? |
@fabpot done |
<container xmlns="http://symfony.com/schema/dic/services" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> | ||
<services> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think indentation needs to be here 4 spaces
…terJ) This PR was submitted for the 2.3-dev branch but it was merged into the 2.3 branch instead (closes #9489). Discussion ---------- [DependencyInjection] Add normalization to tag options Currently, when using tags in XML, the options aren't normalized. This means that the following code is wrong: <tag name="sonata_admin" manager-type="doctrine_phpcr" ... /> It should be `manager_name` to remove errors, but that's not following the XML rules. The solution is to use the same normalization as the configuration: replacing - with _. To be BC, both options (with and without normalization) are kept | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - Commits ------- 06d64d8 Do normalization on tag options
Currently, when using tags in XML, the options aren't normalized. This means that the following code is wrong:
It should be
manager_name
to remove errors, but that's not following the XML rules. The solution is to use the same normalization as the configuration: replacing - with _.To be BC, both options (with and without normalization) are kept