2019-08-11 21:55:12 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Wallabag\CoreBundle\DataFixtures;
|
|
|
|
|
|
|
|
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;
|
|
|
|
use Wallabag\CoreBundle\Entity\IgnoreOriginInstanceRule;
|
|
|
|
|
|
|
|
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
|
|
|
{
|
|
|
|
foreach ($this->container->getParameter('wallabag_core.default_ignore_origin_instance_rules') as $ignore_origin_instance_rule) {
|
|
|
|
$newIgnoreOriginInstanceRule = new IgnoreOriginInstanceRule();
|
|
|
|
$newIgnoreOriginInstanceRule->setRule($ignore_origin_instance_rule['rule']);
|
|
|
|
$manager->persist($newIgnoreOriginInstanceRule);
|
|
|
|
}
|
|
|
|
|
|
|
|
$manager->flush();
|
|
|
|
}
|
|
|
|
}
|