]> git.immae.eu Git - github/wallabag/wallabag.git/blob - src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php
Fix srcset attribute on images downloaded
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / DataFixtures / ORM / LoadSettingData.php
1 <?php
2
3 namespace Wallabag\CoreBundle\DataFixtures\ORM;
4
5 use Craue\ConfigBundle\Entity\Setting;
6 use Doctrine\Common\DataFixtures\AbstractFixture;
7 use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
8 use Doctrine\Common\Persistence\ObjectManager;
9 use Symfony\Component\DependencyInjection\ContainerAwareInterface;
10 use Symfony\Component\DependencyInjection\ContainerInterface;
11
12 class LoadSettingData extends AbstractFixture implements OrderedFixtureInterface, ContainerAwareInterface
13 {
14 /**
15 * @var ContainerInterface
16 */
17 private $container;
18
19 public function setContainer(ContainerInterface $container = null)
20 {
21 $this->container = $container;
22 }
23
24 /**
25 * {@inheritdoc}
26 */
27 public function load(ObjectManager $manager)
28 {
29 foreach ($this->container->getParameter('wallabag_core.default_internal_settings') as $setting) {
30 $newSetting = new Setting();
31 $newSetting->setName($setting['name']);
32 $newSetting->setValue($setting['value']);
33 $newSetting->setSection($setting['section']);
34 $manager->persist($newSetting);
35 }
36
37 $manager->flush();
38 }
39
40 /**
41 * {@inheritdoc}
42 */
43 public function getOrder()
44 {
45 return 29;
46 }
47 }