diff options
Diffstat (limited to 'src/Wallabag/CoreBundle/DataFixtures')
-rw-r--r-- | src/Wallabag/CoreBundle/DataFixtures/ORM/LoadEntryData.php | 35 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/DataFixtures/ORM/LoadUserData.php | 34 |
2 files changed, 69 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadEntryData.php b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadEntryData.php new file mode 100644 index 00000000..fccd06be --- /dev/null +++ b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadEntryData.php | |||
@@ -0,0 +1,35 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Wallabag\CoreBundle\DataFixtures\ORM; | ||
4 | |||
5 | use Doctrine\Common\DataFixtures\AbstractFixture; | ||
6 | use Doctrine\Common\DataFixtures\OrderedFixtureInterface; | ||
7 | use Doctrine\Common\Persistence\ObjectManager; | ||
8 | use Wallabag\CoreBundle\Entity\Entry; | ||
9 | |||
10 | class LoadEntryData extends AbstractFixture implements OrderedFixtureInterface | ||
11 | { | ||
12 | /** | ||
13 | * {@inheritDoc} | ||
14 | */ | ||
15 | public function load(ObjectManager $manager) | ||
16 | { | ||
17 | $entry1 = new Entry($this->getReference('admin-user')); | ||
18 | $entry1->setUrl('http://0.0.0.0'); | ||
19 | $entry1->setTitle('test title'); | ||
20 | $entry1->setContent('This is my content /o/'); | ||
21 | |||
22 | $manager->persist($entry1); | ||
23 | $manager->flush(); | ||
24 | |||
25 | $this->addReference('entry1', $entry1); | ||
26 | } | ||
27 | |||
28 | /** | ||
29 | * {@inheritDoc} | ||
30 | */ | ||
31 | public function getOrder() | ||
32 | { | ||
33 | return 20; | ||
34 | } | ||
35 | } | ||
diff --git a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadUserData.php b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadUserData.php new file mode 100644 index 00000000..da788218 --- /dev/null +++ b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadUserData.php | |||
@@ -0,0 +1,34 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Wallabag\CoreBundle\DataFixtures\ORM; | ||
4 | |||
5 | use Doctrine\Common\DataFixtures\AbstractFixture; | ||
6 | use Doctrine\Common\DataFixtures\OrderedFixtureInterface; | ||
7 | use Doctrine\Common\Persistence\ObjectManager; | ||
8 | use Wallabag\CoreBundle\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->setUsername('admin'); | ||
19 | $userAdmin->setPassword('test'); | ||
20 | |||
21 | $manager->persist($userAdmin); | ||
22 | $manager->flush(); | ||
23 | |||
24 | $this->addReference('admin-user', $userAdmin); | ||
25 | } | ||
26 | |||
27 | /** | ||
28 | * {@inheritDoc} | ||
29 | */ | ||
30 | public function getOrder() | ||
31 | { | ||
32 | return 10; | ||
33 | } | ||
34 | } | ||