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

Using JSON string containing an array in Yaml fixtures #935

Closed
loic425 opened this issue Jun 15, 2018 · 3 comments
Closed

Using JSON string containing an array in Yaml fixtures #935

loic425 opened this issue Jun 15, 2018 · 3 comments

Comments

@loic425
Copy link

loic425 commented Jun 15, 2018

Using doctrine, we now have "json" type (https://www.doctrine-project.org/projects/doctrine-dbal/en/2.7/reference/types.html#json).

We can now have a json string and this works correctly with alice, but when we have an array in the json, we got an error.

Exemple
data: '{"name":"Netflix", "types":["streaming", "video"]}'

It throws that error: "Array to string conversion"

@theofidry
Copy link
Member

Indeed this string would need to be escaped otherwise it's interpreted as for any value. So I would either recommend to try a custom faker provider or help out with #840 :)

@loic425
Copy link
Author

loic425 commented Jun 15, 2018

@theofidry Thank you, it works with this workaround.

parameters:
     data: '{"name":"Netflix", "types":["streeming", "video"]}'

App\Entity\Test:
    test_1:
        __calls:
          - setData: [<{data}>]

@theofidry
Copy link
Member

theofidry commented Jun 15, 2018 via email

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

No branches or pull requests

2 participants