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