public function load(ObjectManager $manager) { $bcrypt = new Bcrypt(); $bcrypt->setCost(16); $admin = new \User\Entity\User(); $admin->setUsername('admin'); $admin->setDisplayName('Admin'); $admin->setEmail('*****@*****.**'); $admin->setState(1); $admin->setPassword($bcrypt->create('password')); $admin->addRole($this->getReference('role_admin')); $userOne = new \User\Entity\User(); $userOne->setUsername('User A'); $userOne->setDisplayName('Anton'); $userOne->setEmail('*****@*****.**'); $userOne->setState(1); $userOne->setPassword($bcrypt->create('password')); $userOne->addRole($this->getReference('role_user')); $userTwo = new \User\Entity\User(); $userTwo->setUsername('User B'); $userTwo->setDisplayName('Berty'); $userTwo->setEmail('*****@*****.**'); $userTwo->setState(1); $userTwo->setPassword($bcrypt->create('password')); $userTwo->addRole($this->getReference('role_user')); $manager->persist($admin); $manager->persist($userOne); $manager->persist($userTwo); $this->addReference('user_admin', $admin); $this->addReference('user_a', $userOne); $this->addReference('user_b', $userTwo); $manager->flush(); }