2015-12-27 22:26:49 +01:00
|
|
|
<?php
|
|
|
|
|
2024-02-19 01:30:12 +01:00
|
|
|
namespace Wallabag\DataFixtures;
|
2015-12-27 22:26:49 +01:00
|
|
|
|
2018-11-26 20:00:01 +01:00
|
|
|
use Doctrine\Bundle\FixturesBundle\Fixture;
|
|
|
|
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
|
2020-06-15 08:25:59 +02:00
|
|
|
use Doctrine\Persistence\ObjectManager;
|
2024-02-19 01:30:12 +01:00
|
|
|
use Wallabag\Entity\Config;
|
|
|
|
use Wallabag\Entity\TaggingRule;
|
2015-12-27 22:26:49 +01:00
|
|
|
|
2018-11-26 20:00:01 +01:00
|
|
|
class TaggingRuleFixtures extends Fixture implements DependentFixtureInterface
|
2015-12-27 22:26:49 +01:00
|
|
|
{
|
2020-06-15 08:25:59 +02:00
|
|
|
public function load(ObjectManager $manager): void
|
2015-12-27 22:26:49 +01:00
|
|
|
{
|
|
|
|
$tr1 = new TaggingRule();
|
|
|
|
$tr1->setRule('content matches "spurs"');
|
2016-04-12 11:36:01 +02:00
|
|
|
$tr1->setTags(['sport']);
|
2023-08-05 18:25:03 +02:00
|
|
|
$tr1->setConfig($this->getReference('admin-config', Config::class));
|
2015-12-27 22:26:49 +01:00
|
|
|
|
|
|
|
$manager->persist($tr1);
|
|
|
|
|
|
|
|
$tr2 = new TaggingRule();
|
|
|
|
$tr2->setRule('content matches "basket"');
|
2016-04-12 11:36:01 +02:00
|
|
|
$tr2->setTags(['sport']);
|
2023-08-05 18:25:03 +02:00
|
|
|
$tr2->setConfig($this->getReference('admin-config', Config::class));
|
2015-12-27 22:26:49 +01:00
|
|
|
|
|
|
|
$manager->persist($tr2);
|
|
|
|
|
2016-05-30 14:18:47 +02:00
|
|
|
$tr3 = new TaggingRule();
|
|
|
|
|
|
|
|
$tr3->setRule('title matches "wallabag"');
|
|
|
|
$tr3->setTags(['wallabag']);
|
2023-08-05 18:25:03 +02:00
|
|
|
$tr3->setConfig($this->getReference('admin-config', Config::class));
|
2016-05-30 14:18:47 +02:00
|
|
|
|
|
|
|
$manager->persist($tr3);
|
|
|
|
|
2017-04-20 14:58:20 +02:00
|
|
|
$tr4 = new TaggingRule();
|
|
|
|
$tr4->setRule('content notmatches "basket"');
|
|
|
|
$tr4->setTags(['foot']);
|
2023-08-05 18:25:03 +02:00
|
|
|
$tr4->setConfig($this->getReference('admin-config', Config::class));
|
2017-04-20 14:58:20 +02:00
|
|
|
|
|
|
|
$manager->persist($tr4);
|
|
|
|
|
2022-03-02 19:11:32 +01:00
|
|
|
$tr5 = new TaggingRule();
|
|
|
|
$tr5->setRule('readingTime <= 5');
|
|
|
|
$tr5->setTags(['shortread']);
|
2023-08-05 18:25:03 +02:00
|
|
|
$tr5->setConfig($this->getReference('empty-config', Config::class));
|
2022-03-02 19:11:32 +01:00
|
|
|
|
|
|
|
$manager->persist($tr5);
|
|
|
|
|
|
|
|
$tr6 = new TaggingRule();
|
|
|
|
$tr6->setRule('readingTime > 5');
|
|
|
|
$tr6->setTags(['longread']);
|
2023-08-05 18:25:03 +02:00
|
|
|
$tr6->setConfig($this->getReference('empty-config', Config::class));
|
2022-03-02 19:11:32 +01:00
|
|
|
|
|
|
|
$manager->persist($tr6);
|
|
|
|
|
2015-12-27 22:26:49 +01:00
|
|
|
$manager->flush();
|
|
|
|
}
|
|
|
|
|
2018-11-26 20:00:01 +01:00
|
|
|
public function getDependencies()
|
2015-12-27 22:26:49 +01:00
|
|
|
{
|
2018-11-26 20:00:01 +01:00
|
|
|
return [
|
|
|
|
ConfigFixtures::class,
|
|
|
|
];
|
2015-12-27 22:26:49 +01:00
|
|
|
}
|
|
|
|
}
|