]> git.immae.eu Git - github/wallabag/wallabag.git/blob - src/Wallabag/CoreBundle/DataFixtures/ORM/LoadTagData.php
fixtures: refactor EntryData, TagData, add a new tag
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / DataFixtures / ORM / LoadTagData.php
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 {
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 }
33
34 $manager->flush();
35 }
36
37 /**
38 * {@inheritdoc}
39 */
40 public function getOrder()
41 {
42 return 25;
43 }
44 }