2019-08-11 23:55:12 +02:00
|
|
|
<?php
|
|
|
|
|
2024-02-19 01:30:12 +01:00
|
|
|
namespace Wallabag\DataFixtures;
|
2019-08-11 23:55:12 +02:00
|
|
|
|
|
|
|
use Doctrine\Bundle\FixturesBundle\Fixture;
|
2020-06-15 08:25:59 +02:00
|
|
|
use Doctrine\Persistence\ObjectManager;
|
2019-08-11 23:55:12 +02:00
|
|
|
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
|
|
|
|
use Symfony\Component\DependencyInjection\ContainerInterface;
|
2024-02-19 01:30:12 +01:00
|
|
|
use Wallabag\Entity\IgnoreOriginInstanceRule;
|
2019-08-11 23:55:12 +02:00
|
|
|
|
|
|
|
class IgnoreOriginInstanceRuleFixtures extends Fixture implements ContainerAwareInterface
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @var ContainerInterface
|
|
|
|
*/
|
|
|
|
private $container;
|
|
|
|
|
2024-02-19 09:31:30 +01:00
|
|
|
public function setContainer(?ContainerInterface $container = null)
|
2019-08-11 23:55:12 +02:00
|
|
|
{
|
|
|
|
$this->container = $container;
|
|
|
|
}
|
|
|
|
|
2020-06-15 08:25:59 +02:00
|
|
|
public function load(ObjectManager $manager): void
|
2019-08-11 23:55:12 +02:00
|
|
|
{
|
2024-02-20 00:47:53 +01:00
|
|
|
foreach ($this->container->getParameter('wallabag.default_ignore_origin_instance_rules') as $ignore_origin_instance_rule) {
|
2019-08-11 23:55:12 +02:00
|
|
|
$newIgnoreOriginInstanceRule = new IgnoreOriginInstanceRule();
|
|
|
|
$newIgnoreOriginInstanceRule->setRule($ignore_origin_instance_rule['rule']);
|
|
|
|
$manager->persist($newIgnoreOriginInstanceRule);
|
|
|
|
}
|
|
|
|
|
|
|
|
$manager->flush();
|
|
|
|
}
|
|
|
|
}
|