]>
Commit | Line | Data |
---|---|---|
1 | <?php | |
2 | ||
3 | namespace Wallabag\CoreBundle\DataFixtures; | |
4 | ||
5 | use Doctrine\Bundle\FixturesBundle\Fixture; | |
6 | use Doctrine\Common\Persistence\ObjectManager; | |
7 | use Wallabag\CoreBundle\Entity\Tag; | |
8 | ||
9 | class TagFixtures extends Fixture | |
10 | { | |
11 | /** | |
12 | * {@inheritdoc} | |
13 | */ | |
14 | public function load(ObjectManager $manager) | |
15 | { | |
16 | $tags = [ | |
17 | 'foo-bar-tag' => 'foo bar', //tag used for EntryControllerTest | |
18 | 'bar-tag' => 'bar', | |
19 | 'baz-tag' => 'baz', // tag used for ExportControllerTest | |
20 | 'foo-tag' => 'foo', | |
21 | 'bob-tag' => 'bob', // tag used for TagRestControllerTest | |
22 | ]; | |
23 | ||
24 | foreach ($tags as $reference => $label) { | |
25 | $tag = new Tag(); | |
26 | $tag->setLabel($label); | |
27 | ||
28 | $manager->persist($tag); | |
29 | ||
30 | $this->addReference($reference, $tag); | |
31 | } | |
32 | ||
33 | $manager->flush(); | |
34 | } | |
35 | } |