# |
Jun 30th 2017, 13:13 |
spencdev |
Ok so in the end you got it to work? |
# |
Jun 30th 2017, 13:11 |
manuweg_ |
apologies |
# |
Jun 30th 2017, 13:11 |
manuweg_ |
just downloaded this client and havent set that up |
# |
Jun 30th 2017, 13:11 |
manuweg_ |
yes, sorry |
# |
Jun 30th 2017, 13:11 |
spencdev |
https://gist.github.com/ |
# |
Jun 30th 2017, 13:10 |
spencdev |
whoa |
# |
Jun 30th 2017, 13:09 |
manuweg_ |
anyway I just set $max to 10 which allows faker to run and insert the fake data |
# |
Jun 30th 2017, 13:08 |
manuweg_ |
$max = pow(10, $nbDigits) - 1; |
# |
Jun 30th 2017, 13:08 |
manuweg_ |
and this line is where the variable is being sets that causes the exception |
# |
Jun 30th 2017, 13:08 |
manuweg_ |
} |
# |
Jun 30th 2017, 13:08 |
manuweg_ |
return mt_rand(0, $max); |
# |
Jun 30th 2017, 13:08 |
manuweg_ |
} |
# |
Jun 30th 2017, 13:08 |
manuweg_ |
return mt_rand(pow(10, $nbDigits - 1), $max); |
# |
Jun 30th 2017, 13:08 |
manuweg_ |
if ($strict) { |
# |
Jun 30th 2017, 13:08 |
manuweg_ |
} |
# |
Jun 30th 2017, 13:07 |
manuweg_ |
throw new \InvalidArgumentException('randomNumber() can only generate numbers up to mt_getrandmax()'); |
# |
Jun 30th 2017, 13:07 |
manuweg_ |
if ($max > mt_getrandmax()) { |
# |
Jun 30th 2017, 13:07 |
manuweg_ |
$max = pow(10, $nbDigits) - 1; |
# |
Jun 30th 2017, 13:07 |
manuweg_ |
} |
# |
Jun 30th 2017, 13:07 |
manuweg_ |
$nbDigits = static::randomDigitNotNull(); |
# |
Jun 30th 2017, 13:07 |
manuweg_ |
if (null === $nbDigits) { |
# |
Jun 30th 2017, 13:07 |
manuweg_ |
} |
# |
Jun 30th 2017, 13:07 |
manuweg_ |
throw new \InvalidArgumentException('randomNumber() generates numbers of fixed width. To generate numbers between two boundaries, use numberBetween() instead.'); |
# |
Jun 30th 2017, 13:07 |
manuweg_ |
if (!is_bool($strict)) { |
# |
Jun 30th 2017, 13:07 |
manuweg_ |
{ |
# |
Jun 30th 2017, 13:07 |
manuweg_ |
public static function randomNumber($nbDigits = null, $strict = false) |
# |
Jun 30th 2017, 13:07 |
manuweg_ |
the error occurs in this function: |
# |
Jun 30th 2017, 13:02 |
manuweg_ |
any ideas? |
# |
Jun 30th 2017, 13:02 |
manuweg_ |
} |
# |
Jun 30th 2017, 13:02 |
manuweg_ |
$populator->execute(['validate' => false]); |
# |
Jun 30th 2017, 13:02 |
manuweg_ |
$this->out("Inserting"); |
# |
Jun 30th 2017, 13:02 |
manuweg_ |
]); |
# |
Jun 30th 2017, 13:02 |
manuweg_ |
'password' => 'password', |
# |
Jun 30th 2017, 13:02 |
manuweg_ |
'email' => function () use ($faker) { return $faker->email(); }, |
# |
Jun 30th 2017, 13:02 |
manuweg_ |
$populator->addEntity($entityPopulator, 20, [ |
# |
Jun 30th 2017, 13:02 |
manuweg_ |
$populator = new \Faker\ORM\CakePHP\Populator($faker); |
# |
Jun 30th 2017, 13:02 |
manuweg_ |
$entityPopulator = new \Faker\ORM\CakePHP\EntityPopulator('Users'); |
# |
Jun 30th 2017, 13:02 |
manuweg_ |
$faker->addProvider(new \Faker\Provider\Internet($faker)); |
# |
Jun 30th 2017, 13:02 |
manuweg_ |
$faker = \Faker\Factory::create(); |
# |
Jun 30th 2017, 13:02 |
manuweg_ |
$this->out("Creating user populator"); |
# |
Jun 30th 2017, 13:02 |
manuweg_ |
{ |