Skip to content

[Config] Fix YamlReferenceDumper prototyped array support #19570

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

Merged
merged 1 commit into from
Sep 14, 2016
Merged

[Config] Fix YamlReferenceDumper prototyped array support #19570

merged 1 commit into from
Sep 14, 2016

Conversation

ogizanagi
Copy link
Contributor

@ogizanagi ogizanagi commented Aug 8, 2016

Q A
Branch? master
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets -
License MIT
Doc PR -

Also related to #19480 which fixes another prototype issue, but cannot be tested properly on Travis because marked as skipped by this missing implementation.

Previous output was:

    [...]
    parameters:

        # Prototype
        name:                 ~
    connections:
        user:                 ~
        pass:                 ~

instead of:

    [...]
    parameters:

        # Prototype
        name:                 ~
    connections:

        # Prototype
        -
            user:                 ~
            pass:                 ~

@@ -19,6 +19,9 @@
"php": ">=5.3.9",
"symfony/filesystem": "~2.3"
},
"require-dev": {
"symfony/yaml": "~2.7|~3.0"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is this the proper versions constraint to use ?

Copy link
Member

Choose a reason for hiding this comment

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

should be ~2.7 on 2.7,
~2.8|~3.0.0 on 2.8
and ~2.8|~3.0 on 3.1
should be done while merging up

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you @nicolas-grekas . I'll update the PR.

@@ -32,7 +31,7 @@ private function getConfigurationAsString()
acme_root:
boolean: true
scalar_empty: ~
scalar_null: ~
scalar_null: null
Copy link
Member

Choose a reason for hiding this comment

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

why is it dumped as null here while all other places using null are dumping it as ~ ?

Copy link
Contributor Author

@ogizanagi ogizanagi Aug 23, 2016

Choose a reason for hiding this comment

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

Because the ExampleConfiguration explicitly sets the default value to null.
When setting a default value, the YamlReferenceDumper will replace the default ~ by this value :)

(This is not related to the changes in this PR, though)

@ogizanagi
Copy link
Contributor Author

Any update about this one ? Should it rather be considered as a new feature as this implementation is missing since the introduction of the yaml dumper ?

@fabpot
Copy link
Member

fabpot commented Sep 13, 2016

As the test is marked as skipped by mentioning specifically that this is not supported, I would say that this is indeed a new feature that needs to be merged in master.

@fabpot
Copy link
Member

fabpot commented Sep 13, 2016

Can you update the PR accordingly? Thanks.

@ogizanagi ogizanagi changed the base branch from 2.7 to master September 14, 2016 08:43
@ogizanagi
Copy link
Contributor Author

ogizanagi commented Sep 14, 2016

@fabpot : PR description updated, branch rebased and target changed. Thanks for your answer :)

I guess #19480 may be considered the same way ?
Then, I'll update the PR once this one is merged in order to resolve conflicts.

@fabpot
Copy link
Member

fabpot commented Sep 14, 2016

Thank you @ogizanagi.

@fabpot fabpot merged commit 063a980 into symfony:master Sep 14, 2016
fabpot added a commit that referenced this pull request Sep 14, 2016
…ort (ogizanagi)

This PR was merged into the 3.2-dev branch.

Discussion
----------

[Config] Fix YamlReferenceDumper prototyped array support

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Also related to #19480 which fixes another prototype issue, but cannot be tested properly on Travis because marked as skipped by this missing implementation.

Previous output was:

```yaml
    [...]
    parameters:

        # Prototype
        name:                 ~
    connections:
        user:                 ~
        pass:                 ~
```

instead of:

```yaml
    [...]
    parameters:

        # Prototype
        name:                 ~
    connections:

        # Prototype
        -
            user:                 ~
            pass:                 ~
```

Commits
-------

063a980 [Config] Fix YamlReferenceDumper prototyped array support
@ogizanagi ogizanagi deleted the config/fix_prototyped_array_yaml_dump_support branch September 14, 2016 19:13
fabpot added a commit that referenced this pull request Sep 16, 2016
…otypes (ogizanagi)

This PR was merged into the 3.2-dev branch.

Discussion
----------

[Config] Fix (Yaml|Xml)ReferenceDumper for nested prototypes

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

This tries to fix the nested prototypes case for the `YamlReferenceDumper` and `XmlReferenceDumper`.

### Before
```yml
cms_pages:

    # Prototype
    page:                 []
```

### After

```yml
cms_pages:

    # Prototype
    page:

        # Prototype
        locale:
            title:                ~ # Required
            path:                 ~ # Required
```

~~However, the `YamlReferenceDumperTest::testDumper` is marked as skipped, due to another unsupported prototype usage, but that's another issue (the `connections` key). Thus, the bug fix must be tested manually :/ (I'd recommend to merge #19570 first)~~

Commits
-------

1e80510 [Config] Fix YamlReferenceDumper for nested prototypes
@fabpot fabpot mentioned this pull request Oct 27, 2016
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.

5 participants