Skip to content
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

Redefine (array) converting populator configuration #56

Merged
merged 4 commits into from
Dec 5, 2023

Conversation

jdreesen
Copy link
Member

@jdreesen jdreesen commented Oct 3, 2023

This redefines the property configuration node of #53, because I don't think this config was good UX.

With the poulator type ConvertingPopulator everything is fine, here it is the same as with the converter.<name>.properties config (<target property name> => <source property name>, i.e. user-defined key with user-defined value).

With the poulator type ArrayConvertingPopulator, however, a specific key with a user-defined value could be added (itemProperty => <custom value>). So suddenly two different types of configuration are mixed here, and I don't think we should do that.

My suggestion for the poulator type ArrayConvertingPopulator is therefore that the value can again be an array (which also corresponds to the config we defined in #54). It would then look like this:

Before (as defined in #53):

  populator:
    my.populator:
      poulator: Neusta\ConverterBundle\Populator\ArrayConvertingPopulator
      converter: my.converter
      property:
        address: adresse
        itemProperty: value

Now:

  populator:
    my.populator:
      poulator: Neusta\ConverterBundle\Populator\ArrayConvertingPopulator
      converter: my.converter
      property:
        address:
          source: adresse
          source_array_item: value

The following is still allowed:

  populator:
    my.populator:
      poulator: Neusta\ConverterBundle\Populator\ArrayConvertingPopulator
      converter: my.converter
      property:
        address: adresse

And likewise:

  populator:
    my.populator:
      poulator: Neusta\ConverterBundle\Populator\ArrayConvertingPopulator
      converter: my.converter
      property:
        address: ~

As well as (source and target with same name):

  populator:
    my.populator:
      poulator: Neusta\ConverterBundle\Populator\ArrayConvertingPopulator
      converter: my.converter
      property:
        address:
          source: ~
          source_array_item: value

And (also source and target with same name):

  populator:
    my.populator:
      poulator: Neusta\ConverterBundle\Populator\ArrayConvertingPopulator
      converter: my.converter
      property:
        address:
          source_array_item: value

Since the use of other populators (apart from ConvertingPopulator and ArrayConvertingPopulator) was not supported anyway, I also limited the config to these two types.

@jdreesen jdreesen changed the title Remove unused config file Redefine converting populator configuration Oct 3, 2023
@jdreesen jdreesen marked this pull request as ready for review October 3, 2023 13:35
Base automatically changed from fixup/#53 to main November 12, 2023 11:59
@jdreesen jdreesen changed the title Redefine converting populator configuration Redefine (array) converting populator configuration Dec 5, 2023
@jdreesen jdreesen merged commit 5fd6983 into main Dec 5, 2023
5 checks passed
@jdreesen jdreesen deleted the fixup/#53-config branch December 5, 2023 22:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant