aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/DataFixtures/TaggingRuleFixtures.php
blob: 78ff314a884f00e5ec7c453d68fd521c3fc57c4a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php

namespace Wallabag\CoreBundle\DataFixtures;

use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Wallabag\CoreBundle\Entity\TaggingRule;

class TaggingRuleFixtures extends Fixture implements DependentFixtureInterface
{
    /**
     * {@inheritdoc}
     */
    public function load(ObjectManager $manager)
    {
        $tr1 = new TaggingRule();
        $tr1->setRule('content matches "spurs"');
        $tr1->setTags(['sport']);
        $tr1->setConfig($this->getReference('admin-config'));

        $manager->persist($tr1);

        $tr2 = new TaggingRule();
        $tr2->setRule('content matches "basket"');
        $tr2->setTags(['sport']);
        $tr2->setConfig($this->getReference('admin-config'));

        $manager->persist($tr2);

        $tr3 = new TaggingRule();

        $tr3->setRule('title matches "wallabag"');
        $tr3->setTags(['wallabag']);
        $tr3->setConfig($this->getReference('admin-config'));

        $manager->persist($tr3);

        $tr4 = new TaggingRule();
        $tr4->setRule('content notmatches "basket"');
        $tr4->setTags(['foot']);
        $tr4->setConfig($this->getReference('admin-config'));

        $manager->persist($tr4);

        $manager->flush();
    }

    /**
     * {@inheritdoc}
     */
    public function getDependencies()
    {
        return [
            ConfigFixtures::class,
        ];
    }
}