Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[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

Closed
wants to merge 1 commit into from

Conversation

wouterj
Copy link
Member

@wouterj wouterj commented Nov 10, 2013

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 -

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
Copy link
Contributor

Choose a reason for hiding this comment

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

line break?

Copy link
Member Author

Choose a reason for hiding this comment

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

line break?

Copy link
Contributor

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

@fabpot
Copy link
Member

fabpot commented Nov 12, 2013

Can you add a unit test?

@wouterj
Copy link
Member Author

wouterj commented Nov 12, 2013

@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>
Copy link
Contributor

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

fabpot added a commit that referenced this pull request Dec 16, 2013
…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
@fabpot fabpot closed this Dec 16, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.