aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/UserBundle/DataFixtures/ORM
diff options
context:
space:
mode:
Diffstat (limited to 'src/Wallabag/UserBundle/DataFixtures/ORM')
-rw-r--r--src/Wallabag/UserBundle/DataFixtures/ORM/LoadUserData.php50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/Wallabag/UserBundle/DataFixtures/ORM/LoadUserData.php b/src/Wallabag/UserBundle/DataFixtures/ORM/LoadUserData.php
new file mode 100644
index 00000000..d48855da
--- /dev/null
+++ b/src/Wallabag/UserBundle/DataFixtures/ORM/LoadUserData.php
@@ -0,0 +1,50 @@
1<?php
2
3namespace Wallabag\UserBundle\DataFixtures\ORM;
4
5use Doctrine\Common\DataFixtures\AbstractFixture;
6use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
7use Doctrine\Common\Persistence\ObjectManager;
8use Wallabag\UserBundle\Entity\User;
9
10class LoadUserData extends AbstractFixture implements OrderedFixtureInterface
11{
12 /**
13 * {@inheritdoc}
14 */
15 public function load(ObjectManager $manager)
16 {
17 $userAdmin = new User();
18 $userAdmin->setName('Big boss');
19 $userAdmin->setEmail('bigboss@wallabag.org');
20 $userAdmin->setUsername('admin');
21 $userAdmin->setPlainPassword('mypassword');
22 $userAdmin->setEnabled(true);
23 $userAdmin->addRole('ROLE_SUPER_ADMIN');
24
25 $manager->persist($userAdmin);
26
27 $this->addReference('admin-user', $userAdmin);
28
29 $bobUser = new User();
30 $bobUser->setName('Bobby');
31 $bobUser->setEmail('bobby@wallabag.org');
32 $bobUser->setUsername('bob');
33 $bobUser->setPlainPassword('mypassword');
34 $bobUser->setEnabled(true);
35
36 $manager->persist($bobUser);
37
38 $this->addReference('bob-user', $bobUser);
39
40 $manager->flush();
41 }
42
43 /**
44 * {@inheritdoc}
45 */
46 public function getOrder()
47 {
48 return 10;
49 }
50}