aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/DataFixtures/SettingFixtures.php
diff options
context:
space:
mode:
authorJérémy Benoist <j0k3r@users.noreply.github.com>2019-05-29 11:14:00 +0200
committerGitHub <noreply@github.com>2019-05-29 11:14:00 +0200
commit73ec68b1ffafb792265a3805833e5cd84c966aed (patch)
tree33c6040c050f85c537f8dbf5e91d8c281db092cd /src/Wallabag/CoreBundle/DataFixtures/SettingFixtures.php
parent2ba365c7c49556cd23b444dc3bb8d4a8cf08809d (diff)
parent2cbee36a0184786644470a84fdd8c720cfcac58e (diff)
downloadwallabag-73ec68b1ffafb792265a3805833e5cd84c966aed.tar.gz
wallabag-73ec68b1ffafb792265a3805833e5cd84c966aed.tar.zst
wallabag-73ec68b1ffafb792265a3805833e5cd84c966aed.zip
Merge pull request #3984 from wallabag/2.4
Merge 2.4 into master
Diffstat (limited to 'src/Wallabag/CoreBundle/DataFixtures/SettingFixtures.php')
-rw-r--r--src/Wallabag/CoreBundle/DataFixtures/SettingFixtures.php38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/DataFixtures/SettingFixtures.php b/src/Wallabag/CoreBundle/DataFixtures/SettingFixtures.php
new file mode 100644
index 00000000..cc7d1f59
--- /dev/null
+++ b/src/Wallabag/CoreBundle/DataFixtures/SettingFixtures.php
@@ -0,0 +1,38 @@
1<?php
2
3namespace Wallabag\CoreBundle\DataFixtures;
4
5use Craue\ConfigBundle\Entity\Setting;
6use Doctrine\Bundle\FixturesBundle\Fixture;
7use Doctrine\Common\Persistence\ObjectManager;
8use Symfony\Component\DependencyInjection\ContainerAwareInterface;
9use Symfony\Component\DependencyInjection\ContainerInterface;
10
11class SettingFixtures 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_internal_settings') as $setting) {
29 $newSetting = new Setting();
30 $newSetting->setName($setting['name']);
31 $newSetting->setValue($setting['value']);
32 $newSetting->setSection($setting['section']);
33 $manager->persist($newSetting);
34 }
35
36 $manager->flush();
37 }
38}