I use Hautelook AliceBundle which use Faker to generate fixtures with real world data.
In Alice, we can use parameters in our YAML file like below:
parameters:
pwd_parameter: anything
My\UserEntity:
#generate 10 users with password equals to my parameter
user_{1..10}:
password: '<{pwd_parameter}>'
Is it possible to use parameters to generate dynamic numbers of fixtures?
The solution I am looking for is to do this:
parameters:
pwd_parameter: anything
nb_users: 10
My\UserEntity:
#generate nb_users users with password equals to my parameter
user_{1..nb_users}: #<---THIS IS THE PROBLEM
password: '<{pwd_parameter}>
I tried:
user_{1.. nb_users }
user_{1.. <nb_users> }
user_{1..<{nb_users}> }
user_{1..<{nb_users}> }
which throws:
Warning: array_merge(): Argument #1 is not an array
How can I generate my number of entities dynamically?