Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple reference fixture range @user{1..10}

https://github.com/nelmio/alice/blob/master/README.md#multiple-references

group{1..10}:
members: @user{1..10}

this example is giving problem

Entity with Id @user_{1..2} and Class Eggs\CoreBundle\Entity\User not found

It is putting as it is. If i change it to @user_* or @user_1, this works fine, but above range is giving me problem.

Code:

user_{1..10}:
email (unique): email()

group_{1..10}:
user: @user_{1..10}
name: name of the group

user: @user_{1..10} <--- this line gives problem. (I have change business to user)

like image 743
Basit Avatar asked May 03 '15 14:05

Basit


1 Answers

It is not particularly clear from Alice fixtures' documentation, but this syntax is for when you want to pass an array of users. Does your $group->user field accept array?

If you want each group to get one user, the solution would be:

group_{1..10}:
    user: @user_<current()>
    name: name of the group
like image 136
Konstantin Pereiaslov Avatar answered Nov 07 '22 15:11

Konstantin Pereiaslov