Skip to content

[Do not merge] Test xml config #3

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
Closed

[Do not merge] Test xml config #3

wants to merge 1 commit into from

Conversation

Nyholm
Copy link
Member

@Nyholm Nyholm commented Apr 21, 2021

This is a small test with XML config. It fails even with a simple example. Im not sure what Im doing wrong

https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">

<framework:config>
<framework:cache app="cache.adapter.filesystem"
Copy link
Member

Choose a reason for hiding this comment

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

that's an invalid config. It should look like that:

<framework:cache name="app" adapter="cache.adapter.filesystem" />
<framework:cache name="system" adapter="cache.adapter.system" />

Prototyped array nodes work in XML by repeating the tag, and the key is hold by an attribute (as XML does not have any way to represent a map, as attribute names and tag names cannot be dynamic in XSD). Btw, that's the reason why the method of the Config\Definition system to mark a prototyped array node as a map is named useAttributeAsKey and accept an argument: it relates to the fact that XML needs an attribute to store the key.

Copy link
Member

Choose a reason for hiding this comment

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

Note that I haven't checked the actual config to be sure that the attribute holding the key is name in that case. So my config might be wrong. But name is the most used in the Symfony configurations so that was an easy guess.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hm.. I think you are considering the pools key.

Here is some Yaml that I would like to convert to XML.

framework:
    cache:
        app: cache.adapter.filesystem
        system: cache.adapter.system

        pools:
            acme:
                adapter: cache.app
            redis:
                adapter: cache.adapter.redis

Copy link
Member Author

Choose a reason for hiding this comment

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

Also note, what I currently have written in this PR is copied from the docs: https://symfony.com/doc/current/cache.html#configuring-cache-with-frameworkbundle

Copy link
Member

Choose a reason for hiding this comment

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

hmm, looks like the XSD has been created putting those a child elements rather than attributes (which is not consistent with other parts of Symfony): https://github.com/symfony/symfony/blob/8361713367e2735fd9b63cd2b6661411a0339811/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd#L275-L286

Copy link

Choose a reason for hiding this comment

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants