]>
Commit | Line | Data |
---|---|---|
1 | <?php | |
2 | ||
3 | namespace Wallabag\CoreBundle\DataFixtures; | |
4 | ||
5 | use Doctrine\Bundle\FixturesBundle\Fixture; | |
6 | use Doctrine\Common\Persistence\ObjectManager; | |
7 | use Symfony\Component\DependencyInjection\ContainerAwareInterface; | |
8 | use Symfony\Component\DependencyInjection\ContainerInterface; | |
9 | use Wallabag\CoreBundle\Entity\IgnoreOriginInstanceRule; | |
10 | ||
11 | class 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 | } |