]> git.immae.eu Git - github/wallabag/wallabag.git/blob - src/Wallabag/UserBundle/DataFixtures/UserFixtures.php
Better random function
[github/wallabag/wallabag.git] / src / Wallabag / UserBundle / DataFixtures / UserFixtures.php
1 <?php
2
3 namespace Wallabag\UserBundle\DataFixtures;
4
5 use Doctrine\Bundle\FixturesBundle\Fixture;
6 use Doctrine\Common\Persistence\ObjectManager;
7 use Wallabag\UserBundle\Entity\User;
8
9 class UserFixtures extends Fixture
10 {
11 /**
12 * {@inheritdoc}
13 */
14 public function load(ObjectManager $manager)
15 {
16 $userAdmin = new User();
17 $userAdmin->setName('Big boss');
18 $userAdmin->setEmail('bigboss@wallabag.org');
19 $userAdmin->setUsername('admin');
20 $userAdmin->setPlainPassword('mypassword');
21 $userAdmin->setEnabled(true);
22 $userAdmin->addRole('ROLE_SUPER_ADMIN');
23
24 $manager->persist($userAdmin);
25
26 $this->addReference('admin-user', $userAdmin);
27
28 $bobUser = new User();
29 $bobUser->setName('Bobby');
30 $bobUser->setEmail('bobby@wallabag.org');
31 $bobUser->setUsername('bob');
32 $bobUser->setPlainPassword('mypassword');
33 $bobUser->setEnabled(true);
34
35 $manager->persist($bobUser);
36
37 $this->addReference('bob-user', $bobUser);
38
39 $emptyUser = new User();
40 $emptyUser->setName('Empty');
41 $emptyUser->setEmail('empty@wallabag.org');
42 $emptyUser->setUsername('empty');
43 $emptyUser->setPlainPassword('mypassword');
44 $emptyUser->setEnabled(true);
45
46 $manager->persist($emptyUser);
47
48 $this->addReference('empty-user', $emptyUser);
49
50 $manager->flush();
51 }
52 }