diff options
author | lizyn <zhiylin@outlook.com> | 2020-02-24 10:04:13 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-24 10:04:13 +0800 |
commit | b19df31d78d881a43bcf6b3215e5fc3781e8e8aa (patch) | |
tree | d0d9861694a4b5e5fbfdbeb53c255ecd15fe9328 /src/Wallabag/CoreBundle/DataFixtures/InternalSettingFixtures.php | |
parent | 4d0c632c70ea50d459c3c55ddda2e0f394dd51cb (diff) | |
parent | 04d918cae0227c06a41d27fb6533dddbf30dfe71 (diff) | |
download | wallabag-b19df31d78d881a43bcf6b3215e5fc3781e8e8aa.tar.gz wallabag-b19df31d78d881a43bcf6b3215e5fc3781e8e8aa.tar.zst wallabag-b19df31d78d881a43bcf6b3215e5fc3781e8e8aa.zip |
Merge pull request #1 from wallabag/master
Keep up with the master again
Diffstat (limited to 'src/Wallabag/CoreBundle/DataFixtures/InternalSettingFixtures.php')
-rw-r--r-- | src/Wallabag/CoreBundle/DataFixtures/InternalSettingFixtures.php | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/DataFixtures/InternalSettingFixtures.php b/src/Wallabag/CoreBundle/DataFixtures/InternalSettingFixtures.php new file mode 100644 index 00000000..b052d1d5 --- /dev/null +++ b/src/Wallabag/CoreBundle/DataFixtures/InternalSettingFixtures.php | |||
@@ -0,0 +1,38 @@ | |||
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\InternalSetting; | ||
10 | |||
11 | class InternalSettingFixtures 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 InternalSetting(); | ||
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 | } | ||