]>
Commit | Line | Data |
---|---|---|
fc732227 JB |
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\Tag; | |
9 | ||
10 | class LoadTagData extends AbstractFixture implements OrderedFixtureInterface | |
11 | { | |
12 | /** | |
13 | * {@inheritdoc} | |
14 | */ | |
15 | public function load(ObjectManager $manager) | |
16 | { | |
bafb9744 KD |
17 | $tags = [ |
18 | 'foo-bar-tag' => 'foo bar', //tag used for EntryControllerTest | |
19 | 'bar-tag' => 'bar', | |
20 | 'baz-tag' => 'baz', // tag used for ExportControllerTest | |
21 | 'foo-tag' => 'foo', | |
22 | 'bob-tag' => 'bob', // tag used for TagRestControllerTest | |
23 | ]; | |
24 | ||
25 | foreach ($tags as $reference => $label) { | |
26 | $tag = new Tag(); | |
27 | $tag->setLabel($label); | |
28 | ||
29 | $manager->persist($tag); | |
30 | ||
31 | $this->addReference($reference, $tag); | |
32 | } | |
7c04b739 | 33 | |
fc732227 JB |
34 | $manager->flush(); |
35 | } | |
36 | ||
37 | /** | |
38 | * {@inheritdoc} | |
39 | */ | |
40 | public function getOrder() | |
41 | { | |
42 | return 25; | |
43 | } | |
44 | } |