多个参考夹具范围@user {1..10}

时间:2021-09-07 06:47:41

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

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

未找到Id @user_ {1..2}和Class Eggs \ CoreBundle \ Entity \ User的实体

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.

它按原样放置。如果我将其更改为@ user_ *或@ user_1,这可以正常工作,但是超出范围会给我带来问题。

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)

user:@user_ {1..10} <---这一行给出了问题。 (我已将业务更改为用户)

1 个解决方案

#1


1  

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?

从Alice fixtures的文档中不是特别清楚,但是这种语法适用于想要传递用户数组的时候。你的$ group-> user字段是否接受数组?

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

如果您希望每个组获得一个用户,解决方案将是:

group_{1..10}:
    user: @user_<current()>
    name: name of the group

#1


1  

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?

从Alice fixtures的文档中不是特别清楚,但是这种语法适用于想要传递用户数组的时候。你的$ group-> user字段是否接受数组?

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

如果您希望每个组获得一个用户,解决方案将是:

group_{1..10}:
    user: @user_<current()>
    name: name of the group