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