diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2015-10-03 06:29:55 +0200 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2015-10-03 13:31:48 +0200 |
commit | 0a878469d4038c36c84d1dd707265d880fa342e8 (patch) | |
tree | 2e183d359d3f1f0767ebf56277f3fc7aa415ac3f /src/Wallabag/UserBundle/DataFixtures | |
parent | 1210dae10589515d6f3824c75639342c5e1d52dd (diff) | |
download | wallabag-0a878469d4038c36c84d1dd707265d880fa342e8.tar.gz wallabag-0a878469d4038c36c84d1dd707265d880fa342e8.tar.zst wallabag-0a878469d4038c36c84d1dd707265d880fa342e8.zip |
move some files to UserBundle
Diffstat (limited to 'src/Wallabag/UserBundle/DataFixtures')
-rw-r--r-- | src/Wallabag/UserBundle/DataFixtures/ORM/LoadUserData.php | 50 |
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 | |||
3 | namespace Wallabag\UserBundle\DataFixtures\ORM; | ||
4 | |||
5 | use Doctrine\Common\DataFixtures\AbstractFixture; | ||
6 | use Doctrine\Common\DataFixtures\OrderedFixtureInterface; | ||
7 | use Doctrine\Common\Persistence\ObjectManager; | ||
8 | use Wallabag\UserBundle\Entity\User; | ||
9 | |||
10 | class 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 | } | ||