/**
  * Change Method.
  *
  * More information on this method is available here:
  * http://docs.phinx.org/en/latest/migrations.html#the-change-method
  * @return void
  */
 public function change()
 {
     $faker = \Faker\Factory::create();
     $populator = new \Faker\ORM\CakePHP\Populator($faker);
     $populator->addEntity('Meetings_Users', 50, ['meeting_id' => function () use($faker) {
         return $faker->numberBetween(1, 50);
     }, 'user_id' => function () use($faker) {
         return $faker->numberBetween(1, 50);
     }]);
     $populator->execute(['validate' => false]);
 }
 /**
  * Change Method.
  *
  * More information on this method is available here:
  * http://docs.phinx.org/en/latest/migrations.html#the-change-method
  * @return void
  */
 public function change()
 {
     $faker = \Faker\Factory::create();
     $faker->addProvider(new \Faker\Provider\Lorem($faker));
     $faker->addProvider(new \Faker\Provider\DateTime($faker));
     $populator = new \Faker\ORM\CakePHP\Populator($faker);
     $populator->addEntity('Meetings', 50, ['date' => function () use($faker) {
         return $faker->dateTimeThisMonth();
     }, 'created' => null, 'modified' => null]);
     $populator->execute(['validate' => false]);
 }
Пример #3
0
 /**
  * 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]);
 }
 public function up()
 {
     $faker = \Faker\Factory::create();
     $populator = new Faker\ORM\CakePHP\Populator($faker);
     $populator->addEntity('Users', 1, ['first_name' => 'Edson', 'last_name' => 'Mollericona', 'email' => '*****@*****.**', 'password' => function () {
         return 'secret';
     }, 'role' => 'admin', 'active' => 1, 'created' => function () use($faker) {
         return $faker->dateTimeBetween($startDate = 'now', $endDate = 'now');
     }, 'modified' => function () use($faker) {
         return $faker->dateTimeBetween($startDate = 'now', $endDate = 'now');
     }]);
     $populator->execute();
 }
 /**
  * Change Method.
  *
  * More information on this method is available here:
  * http://docs.phinx.org/en/latest/migrations.html#the-change-method
  * @return void
  */
 public function change()
 {
     $faker = \Faker\Factory::create();
     $faker->addProvider(new \Faker\Provider\Lorem($faker));
     $populator = new \Faker\ORM\CakePHP\Populator($faker);
     $populator->addEntity('Departments_Users', 5, ['department_id' => function () use($faker) {
         return $faker->numberBetween(1, 5);
     }, 'user_id' => function () use($faker) {
         return $faker->numberBetween(1, 50);
     }, 'title' => function () use($faker) {
         return $faker->text(50);
     }]);
     $populator->execute(['validate' => false]);
 }
Пример #6
0
 public function change()
 {
     $faker = \Faker\Factory::create();
     $faker->addProvider(new \Faker\Provider\Internet($faker));
     $populator = new \Faker\ORM\CakePHP\Populator($faker);
     $populator->addEntity('Users', 100, ['email' => function () use($faker) {
         return $faker->unique()->email();
     }, 'name' => function () use($faker) {
         return $faker->firstName() . " " . $faker->lastName();
     }, 'password' => function () use($faker) {
         return $faker->password();
     }, 'created' => null, 'modified' => null]);
     $populator->execute(['validate' => false]);
 }
 public function up()
 {
     $faker = \Faker\Factory::create();
     $populator = new Faker\ORM\CakePHP\Populator($faker);
     $populator->addEntity('Bookmarks', 200, ['title' => function () use($faker) {
         return $faker->sentence($nbWords = 3, $variableNbWords = true);
     }, 'description' => function () use($faker) {
         return $faker->paragraph($nbSentences = 3, $variableNbSentences = true);
     }, 'url' => function () use($faker) {
         return $faker->url;
     }, 'created' => function () use($faker) {
         return $faker->dateTimeBetween($startDate = 'now', $endDate = 'now');
     }, 'modified' => function () use($faker) {
         return $faker->dateTimeBetween($startDate = 'now', $endDate = 'now');
     }, 'user_id' => function () {
         return rand(1, 51);
     }]);
     $populator->execute();
 }
 /**
  * Change Method.
  *
  * More information on this method is available here:
  * http://docs.phinx.org/en/latest/migrations.html#the-change-method
  * @return void
  */
 public function change()
 {
     $faker = \Faker\Factory::create();
     $faker->addProvider(new \Faker\Provider\Company($faker));
     $faker->addProvider(new \Faker\Provider\Address($faker));
     $faker->addProvider(new \Faker\Provider\PhoneNumber($faker));
     $faker->addProvider(new \Faker\Provider\Internet($faker));
     $populator = new \Faker\ORM\CakePHP\Populator($faker);
     $populator->addEntity('Customers', 200, ['name' => function () use($faker) {
         return $faker->unique()->company();
     }, 'address' => function () use($faker) {
         return $faker->unique()->address();
     }, 'phoneNumber' => function () use($faker) {
         return $faker->unique()->phoneNumber();
     }, 'email' => function () use($faker) {
         return $faker->unique()->companyEmail();
     }, 'corporateId' => function () use($faker) {
         return $faker->unique()->randomNumber(9);
     }, 'created' => null, 'modified' => null]);
     $populator->execute(['validate' => false]);
 }
 public function up()
 {
     $faker = \Faker\Factory::create();
     $populator = new Faker\ORM\CakePHP\Populator($faker);
     $populator->addEntity('Users', 50, ['first_name' => function () use($faker) {
         return $faker->firstName();
     }, 'last_name' => function () use($faker) {
         return $faker->lastName();
     }, 'email' => function () use($faker) {
         return $faker->safeEmail();
     }, 'password' => function () {
         return 'secret';
     }, 'role' => 'user', 'active' => function () {
         return rand(0, 1);
     }, 'created' => function () use($faker) {
         return $faker->dateTimeBetween($startDate = 'now', $endDate = 'now');
     }, 'modified' => function () use($faker) {
         return $faker->dateTimeBetween($startDate = 'now', $endDate = 'now');
     }]);
     $populator->execute();
 }