mirror of https://github.com/wallabag/wallabag.git
36 lines
1.0 KiB
PHP
36 lines
1.0 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();
|
|
}
|
|
}
|