mirror of
https://github.com/wallabag/wallabag.git
synced 2024-12-17 02:39:24 +01:00
34 lines
1.0 KiB
PHP
34 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace Wallabag\DataFixtures;
|
|
|
|
use Doctrine\Bundle\FixturesBundle\Fixture;
|
|
use Doctrine\Persistence\ObjectManager;
|
|
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
|
|
use Symfony\Component\DependencyInjection\ContainerInterface;
|
|
use Wallabag\Entity\IgnoreOriginInstanceRule;
|
|
|
|
class IgnoreOriginInstanceRuleFixtures extends Fixture implements ContainerAwareInterface
|
|
{
|
|
/**
|
|
* @var ContainerInterface
|
|
*/
|
|
private $container;
|
|
|
|
public function setContainer(?ContainerInterface $container = null)
|
|
{
|
|
$this->container = $container;
|
|
}
|
|
|
|
public function load(ObjectManager $manager): void
|
|
{
|
|
foreach ($this->container->getParameter('wallabag.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();
|
|
}
|
|
}
|