Last active
January 26, 2016 23:53
-
-
Save vaughany/28fcb9b11d89fa1bcca7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| namespace App\Shell; | |
| use Cake\Console\Shell; | |
| /** | |
| * DummyData shell command. | |
| */ | |
| class DummyDataShell extends Shell | |
| { | |
| /** | |
| * main() method. | |
| * | |
| * @return bool|int Success or error code. | |
| */ | |
| public function main() | |
| { | |
| $this->out("Creating user populator"); | |
| $faker = \Faker\Factory::create(); | |
| $faker->addProvider(new \Faker\Provider\Internet($faker)); | |
| $entityPopulator = new \Faker\ORM\CakePHP\EntityPopulator('Users'); | |
| $populator = new \Faker\ORM\CakePHP\Populator($faker); | |
| $populator->addEntity($entityPopulator, 20, [ | |
| 'email' => function () use ($faker) { return $faker->email(); }, | |
| 'password' => 'password', | |
| ]); | |
| $this->out("Inserting"); | |
| $populator->execute(['validate' => false]); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment