]> git.immae.eu Git - github/wallabag/wallabag.git/blame_incremental - src/Wallabag/CoreBundle/DataFixtures/IgnoreOriginInstanceRuleFixtures.php
Merge pull request #4438 from wallabag/dependabot/composer/scheb/two-factor-bundle...
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / DataFixtures / IgnoreOriginInstanceRuleFixtures.php
... / ...
CommitLineData
1<?php
2
3namespace Wallabag\CoreBundle\DataFixtures;
4
5use Doctrine\Bundle\FixturesBundle\Fixture;
6use Doctrine\Common\Persistence\ObjectManager;
7use Symfony\Component\DependencyInjection\ContainerAwareInterface;
8use Symfony\Component\DependencyInjection\ContainerInterface;
9use Wallabag\CoreBundle\Entity\IgnoreOriginInstanceRule;
10
11class IgnoreOriginInstanceRuleFixtures extends Fixture implements ContainerAwareInterface
12{
13 /**
14 * @var ContainerInterface
15 */
16 private $container;
17
18 public function setContainer(ContainerInterface $container = null)
19 {
20 $this->container = $container;
21 }
22
23 /**
24 * {@inheritdoc}
25 */
26 public function load(ObjectManager $manager)
27 {
28 foreach ($this->container->getParameter('wallabag_core.default_ignore_origin_instance_rules') as $ignore_origin_instance_rule) {
29 $newIgnoreOriginInstanceRule = new IgnoreOriginInstanceRule();
30 $newIgnoreOriginInstanceRule->setRule($ignore_origin_instance_rule['rule']);
31 $manager->persist($newIgnoreOriginInstanceRule);
32 }
33
34 $manager->flush();
35 }
36}