mirror of
https://github.com/wallabag/wallabag.git
synced 2024-11-27 03:21:01 +00:00
35 lines
1 KiB
PHP
35 lines
1 KiB
PHP
<?php
|
|
|
|
namespace Wallabag\DataFixtures;
|
|
|
|
use Doctrine\Bundle\FixturesBundle\Fixture;
|
|
use Doctrine\Persistence\ObjectManager;
|
|
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
|
|
use Symfony\Component\DependencyInjection\ContainerInterface;
|
|
use Wallabag\Entity\InternalSetting;
|
|
|
|
class InternalSettingFixtures extends Fixture implements ContainerAwareInterface
|
|
{
|
|
/**
|
|
* @var ContainerInterface
|
|
*/
|
|
private $container;
|
|
|
|
public function setContainer(?ContainerInterface $container = null)
|
|
{
|
|
$this->container = $container;
|
|
}
|
|
|
|
public function load(ObjectManager $manager): void
|
|
{
|
|
foreach ($this->container->getParameter('wallabag.default_internal_settings') as $setting) {
|
|
$newSetting = new InternalSetting();
|
|
$newSetting->setName($setting['name']);
|
|
$newSetting->setValue($setting['value']);
|
|
$newSetting->setSection($setting['section']);
|
|
$manager->persist($newSetting);
|
|
}
|
|
|
|
$manager->flush();
|
|
}
|
|
}
|