-
-
Notifications
You must be signed in to change notification settings - Fork 328
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
Got array instead of reference #1018
Comments
Which version are you using? You have option to do like this: include:
- client_type.yaml
AppBundle\Entity\Client:
client_{1..20}:
name: '<name()>'
client_type: '<randomElement(@client_type_{1..10})>' or simply like this: include:
- client_type.yaml
AppBundle\Entity\Client:
client_{1..20}:
name: '<name()>'
client_type: '@client_type_*' In the docs you provided it only says how to use the reference of the object you've created, in this case: # this will create a collection of ClientType named as `client_type_` from 1 to 10
AppBundle\Entity\ClientType:
client_type_{1..10}:
name: '<name()>' you can use its reference either:
|
Thank you for your help. I am using the version 3.5.8. With |
Actually whenever you use the operator To solve your problem you can follow the comment above it will be fine for you. include:
- client_type.yaml
AppBundle\Entity\Client:
client_{1..20}:
name: '<name()>'
client_type: '<randomElement(@client_type_{1..10})>' |
I am using the randomElement feature, It is just to ask if the doc is wrong or not and to report it if it is the case. Because of Closing here, thank you for your help. |
Let's check if that's a bug or the doc that is not correct :) |
To me, this is a documentation issue. It should say |
I just face a similar issue when trying to receive one single entity but get an array of entities when declaring
I checked and it basically tries to resolve |
Hello,
https://github.com/nelmio/alice/blob/v3.5.8/doc/advanced-guide.md#references
@user_{alice, bob} => @user_alice or @user_bob
If i:
client_type:
I got:
Expected argument of type "AppBundle\Entity\ClientType or null", "array" given
It gives me an array with the 10 ClientType for the client_type field.
Is it normal?
Thank you
The text was updated successfully, but these errors were encountered: