]>
Commit | Line | Data |
---|---|---|
3b815d2d J |
1 | <?php |
2 | ||
db9b6d8d | 3 | namespace Wallabag\UserBundle\DataFixtures; |
3b815d2d | 4 | |
db9b6d8d | 5 | use Doctrine\Bundle\FixturesBundle\Fixture; |
3b815d2d | 6 | use Doctrine\Common\Persistence\ObjectManager; |
1210dae1 | 7 | use Wallabag\UserBundle\Entity\User; |
3b815d2d | 8 | |
db9b6d8d | 9 | class UserFixtures extends Fixture |
3b815d2d J |
10 | { |
11 | /** | |
8ce32af6 | 12 | * {@inheritdoc} |
3b815d2d J |
13 | */ |
14 | public function load(ObjectManager $manager) | |
15 | { | |
16 | $userAdmin = new User(); | |
eb3bd7ef J |
17 | $userAdmin->setName('Big boss'); |
18 | $userAdmin->setEmail('bigboss@wallabag.org'); | |
3b815d2d | 19 | $userAdmin->setUsername('admin'); |
fcb1fba5 | 20 | $userAdmin->setPlainPassword('mypassword'); |
a1691859 | 21 | $userAdmin->setEnabled(true); |
fcb1fba5 | 22 | $userAdmin->addRole('ROLE_SUPER_ADMIN'); |
3b815d2d J |
23 | |
24 | $manager->persist($userAdmin); | |
3b815d2d J |
25 | |
26 | $this->addReference('admin-user', $userAdmin); | |
eb3bd7ef J |
27 | |
28 | $bobUser = new User(); | |
29 | $bobUser->setName('Bobby'); | |
30 | $bobUser->setEmail('bobby@wallabag.org'); | |
31 | $bobUser->setUsername('bob'); | |
fcb1fba5 | 32 | $bobUser->setPlainPassword('mypassword'); |
a1691859 | 33 | $bobUser->setEnabled(true); |
eb3bd7ef J |
34 | |
35 | $manager->persist($bobUser); | |
36 | ||
37 | $this->addReference('bob-user', $bobUser); | |
38 | ||
5c072d2b NL |
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 | ||
eb3bd7ef | 50 | $manager->flush(); |
3b815d2d | 51 | } |
3b815d2d | 52 | } |