]>
Commit | Line | Data |
---|---|---|
4dc87223 NL |
1 | <?php |
2 | ||
db9b6d8d | 3 | namespace Wallabag\AnnotationBundle\DataFixtures; |
4dc87223 | 4 | |
db9b6d8d JB |
5 | use Doctrine\Bundle\FixturesBundle\Fixture; |
6 | use Doctrine\Common\DataFixtures\DependentFixtureInterface; | |
4dc87223 NL |
7 | use Doctrine\Common\Persistence\ObjectManager; |
8 | use Wallabag\AnnotationBundle\Entity\Annotation; | |
db9b6d8d JB |
9 | use Wallabag\CoreBundle\DataFixtures\EntryFixtures; |
10 | use Wallabag\UserBundle\DataFixtures\UserFixtures; | |
4dc87223 | 11 | |
db9b6d8d | 12 | class AnnotationFixtures extends Fixture implements DependentFixtureInterface |
4dc87223 NL |
13 | { |
14 | /** | |
15 | * {@inheritdoc} | |
16 | */ | |
17 | public function load(ObjectManager $manager) | |
18 | { | |
19 | $annotation1 = new Annotation($this->getReference('admin-user')); | |
20 | $annotation1->setEntry($this->getReference('entry1')); | |
21 | $annotation1->setText('This is my annotation /o/'); | |
22 | $annotation1->setQuote('content'); | |
23 | ||
24 | $manager->persist($annotation1); | |
25 | ||
26 | $this->addReference('annotation1', $annotation1); | |
27 | ||
28 | $annotation2 = new Annotation($this->getReference('admin-user')); | |
29 | $annotation2->setEntry($this->getReference('entry2')); | |
30 | $annotation2->setText('This is my 2nd annotation /o/'); | |
31 | $annotation2->setQuote('content'); | |
32 | ||
33 | $manager->persist($annotation2); | |
34 | ||
35 | $this->addReference('annotation2', $annotation2); | |
36 | ||
37 | $manager->flush(); | |
38 | } | |
39 | ||
40 | /** | |
41 | * {@inheritdoc} | |
42 | */ | |
db9b6d8d | 43 | public function getDependencies() |
4dc87223 | 44 | { |
db9b6d8d JB |
45 | return [ |
46 | EntryFixtures::class, | |
47 | UserFixtures::class, | |
48 | ]; | |
4dc87223 NL |
49 | } |
50 | } |