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

Allow arrays parameters #216

Merged
merged 1 commit into from Jun 12, 2015
Merged

Conversation

ogizanagi
Copy link
Contributor

This allow to have array parameters. For instance:

#fixtures.yml
parameters:
    usernames: ['Alice', 'Bob', 'Ryan']

Nelmio\Entity\User:
    user{1..50}:
        username: <randomElement(<{usernames}>)>

and associative arrays:

parameters: 
    config: { host: localhost, port: 4567 }

Without this change, you'll get an Array to string conversion error:

However, note that it is already doable by enforcing the yaml array to be interpreted as a string:

parameters:
    usernames: "['Alice', 'Bob', 'Ryan']"

@Seldaek
Copy link
Member

Seldaek commented Jun 11, 2015

Could you add a test for it?

@ogizanagi
Copy link
Contributor Author

Tests added. One or the other should be sufficient, though.
Let me now if I should remove one.

@Seldaek
Copy link
Member

Seldaek commented Jun 12, 2015

Thanks looks good to me, hopefully I am not missing anything

Seldaek added a commit that referenced this pull request Jun 12, 2015
@Seldaek Seldaek merged commit 370538d into nelmio:master Jun 12, 2015
@tshelburne
Copy link
Collaborator

👍

@ogizanagi ogizanagi deleted the param/arrays_support branch June 12, 2015 18:16
@Perfect-Web
Copy link

does the associative array work ? i couldnt make it work no matter what

@theofidry
Copy link
Member

@Perfect-Web it works fine on 3.x I didn't check on 2.x. If it doesn't and you wish it to work, feel free to open a new issue for it or a PR, but don't dig zombies please :)

@Perfect-Web
Copy link

@theofidry thats fine :) but still is on edge php 7 only sooo unless we change all the env, there is nothing to do ...

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.

None yet

5 participants