2016-01-21 11:23:45 +00:00
|
|
|
<?php
|
|
|
|
|
2018-11-26 19:00:01 +00:00
|
|
|
namespace Wallabag\CoreBundle\DataFixtures;
|
2016-01-21 11:23:45 +00:00
|
|
|
|
2018-11-26 19:00:01 +00:00
|
|
|
use Doctrine\Bundle\FixturesBundle\Fixture;
|
2020-06-15 06:25:59 +00:00
|
|
|
use Doctrine\Persistence\ObjectManager;
|
2017-06-02 08:19:33 +00:00
|
|
|
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
|
|
|
|
use Symfony\Component\DependencyInjection\ContainerInterface;
|
2019-08-08 13:19:53 +00:00
|
|
|
use Wallabag\CoreBundle\Entity\InternalSetting;
|
2016-01-21 11:23:45 +00:00
|
|
|
|
2019-08-08 13:19:53 +00:00
|
|
|
class InternalSettingFixtures extends Fixture implements ContainerAwareInterface
|
2016-01-21 11:23:45 +00:00
|
|
|
{
|
2017-06-02 08:19:33 +00:00
|
|
|
/**
|
|
|
|
* @var ContainerInterface
|
|
|
|
*/
|
|
|
|
private $container;
|
|
|
|
|
2024-02-19 08:31:30 +00:00
|
|
|
public function setContainer(?ContainerInterface $container = null)
|
2017-06-02 08:19:33 +00:00
|
|
|
{
|
|
|
|
$this->container = $container;
|
|
|
|
}
|
|
|
|
|
2020-06-15 06:25:59 +00:00
|
|
|
public function load(ObjectManager $manager): void
|
2016-01-21 11:23:45 +00:00
|
|
|
{
|
2017-06-02 08:19:33 +00:00
|
|
|
foreach ($this->container->getParameter('wallabag_core.default_internal_settings') as $setting) {
|
2019-08-08 13:19:53 +00:00
|
|
|
$newSetting = new InternalSetting();
|
2016-01-21 11:23:45 +00:00
|
|
|
$newSetting->setName($setting['name']);
|
|
|
|
$newSetting->setValue($setting['value']);
|
|
|
|
$newSetting->setSection($setting['section']);
|
|
|
|
$manager->persist($newSetting);
|
|
|
|
}
|
|
|
|
|
|
|
|
$manager->flush();
|
|
|
|
}
|
|
|
|
}
|