Skip to content

Navigation Menu

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

[Config] Allow overriding array nodes and prototyped array nodes #57873

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

Open
wants to merge 1 commit into
base: 7.3
Choose a base branch
Loading
from

Conversation

jakubtobiasz
Copy link

@jakubtobiasz jakubtobiasz commented Jul 29, 2024

Q A
Branch? 7.2
Bug fix? no
New feature? yes
Deprecations? no
Issues n/a
License MIT

This feature is inspired by https://docs.docker.com/compose/compose-file/13-merge/#replace-value. The idea is to allow fully override number-indexed keys. For example, we are not able to override workflows' from values, because they're merged.

Let's consider the following YAML configuration:

framework:
    workflows:
        catalog_promotion:
            # ...
            transitions:
                process:
                    from:
                        - inactive
                        - active
                    to: processing

Currently, we are able to add new from, but we cannot remove any of existing. It's important from POV of projects like Sylius. Thanks to this PR, we can create the following configuration from the end-app level:

framework:
    workflows:
        catalog_promotion:
            # ...
            transitions:
                process:
                    !from:
                        - semiactive
                        - active

The result is from: semiactive, active

@carsonbot
Copy link

Hey!

I see that this is your first PR. That is great! Welcome!

Symfony has a contribution guide which I suggest you to read.

In short:

  • Always add tests
  • Keep backward compatibility (see https://symfony.com/bc).
  • Bug fixes must be submitted against the lowest maintained branch where they apply (see https://symfony.com/releases)
  • Features and deprecations must be submitted against the 7.2 branch.

Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change.

When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor!
If this PR is merged in a lower version branch, it will be merged up to all maintained branches within a few days.

I am going to sit back now and wait for the reviews.

Cheers!

Carsonbot

@nicolas-grekas
Copy link
Member

Looking at https://docs.docker.com/compose/compose-file/13-merge/#replace-value, they use a yaml tag for this.
Is that something we could do also?

@jakubtobiasz
Copy link
Author

Hi @nicolas-grekas 🙋🏼‍♂️,

thanks for looking at my PR :). I believe we're able to handle it similarly. My way was easier and universal across all config formats. In such way, we should handle it like:

YAML:

#...
from: !override
	- from_a
	- from_b

PHP:

	->override()

XML:

	<... override="true">

I'll try to implement this 🧐.

@stof
Copy link
Member

stof commented Aug 13, 2024

The merging happens during the processing of the configuration in the DI extension (based on the Configuration class). So it would be hard to use such Yaml tags for that.

I would say that from places for a workflow transition should never be merged between different files redefining the transition, which would be doable by using the ->performNoDeepMerging() in the Configuration class. In the old days of Symfony, we were careful about where merging should happen in our configuration and where it should be disabled. I have the feeling that this was less considered in more recent times, which means we should probably review our Configuration to identify places where deep merging does not make sense.

@fabpot fabpot modified the milestones: 7.2, 7.3 Nov 20, 2024
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
Morty Proxy This is a proxified and sanitized view of the page, visit original site.