public function postUp(Schema $schema) { $em = $this->getEntityManager(); $user = new User(); $user->setUsername('user1'); $user->setEmail('*****@*****.**'); $user->setPassword('$2y$14$W0X.ePvHECLnTZd8UMmLhOszqhkObhzKJBWSe37BysuTHwBlxwsbu'); // userPassword $user->setDisplayName('User 1'); $user->setState(1); $em->persist($user); $admin = new User(); $admin->setUsername('admin1'); $admin->setEmail('*****@*****.**'); $admin->setPassword('$2y$14$7QygVnmYd/tRLgEox.wBruRe1rlDbawP7MmtdNVn6NgN2AIGDdpcm'); // adminPassword $admin->setDisplayName('Admin 1'); $admin->setState(1); $em->persist($admin); $em->flush(); }
/** * Change Method. * * Write your reversible migrations using this method. * * More information on writing migrations is available here: * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class */ public function change() { $userTable = $this->table('user'); $userTable->addColumn('username', 'string', ['limit' => 255])->addColumn('email', 'string', ['limit' => 255, 'null' => false])->addColumn('display_name', 'string', ['limit' => 255, 'null' => false])->addColumn('password', 'string', ['limit' => 128, 'null' => false])->addColumn('state', 'string', ['limit' => 1, 'default' => 1])->addIndex(['username'], ['unique' => true, 'name' => 'username_idx'])->addIndex(['email'], ['unique' => true, 'name' => 'email_idx'])->addIndex(['display_name'], ['unique' => true, 'name' => 'display_name_idx'])->create(); $em = $this->getEntityManager(); $user = new User(); $user->setUsername('user1'); $user->setEmail('*****@*****.**'); $user->setPassword('$2y$14$W0X.ePvHECLnTZd8UMmLhOszqhkObhzKJBWSe37BysuTHwBlxwsbu'); // userPassword $user->setDisplayName('User 1'); $user->setState(1); $em->persist($user); $admin = new User(); $admin->setUsername('admin1'); $admin->setEmail('*****@*****.**'); $admin->setPassword('$2y$14$7QygVnmYd/tRLgEox.wBruRe1rlDbawP7MmtdNVn6NgN2AIGDdpcm'); // adminPassword $admin->setDisplayName('Admin 1'); $admin->setState(1); $em->persist($admin); $em->flush(); }