forked from wallabag/wallabag
Update fixtures
This commit is contained in:
39
src/Wallabag/CoreBundle/DataFixtures/SettingFixtures.php
Normal file
39
src/Wallabag/CoreBundle/DataFixtures/SettingFixtures.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace Wallabag\CoreBundle\DataFixtures;
|
||||
|
||||
use Craue\ConfigBundle\Entity\Setting;
|
||||
use Doctrine\Bundle\FixturesBundle\Fixture;
|
||||
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
|
||||
use Doctrine\Common\Persistence\ObjectManager;
|
||||
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
||||
class SettingFixtures extends Fixture implements ContainerAwareInterface
|
||||
{
|
||||
/**
|
||||
* @var ContainerInterface
|
||||
*/
|
||||
private $container;
|
||||
|
||||
public function setContainer(ContainerInterface $container = null)
|
||||
{
|
||||
$this->container = $container;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function load(ObjectManager $manager)
|
||||
{
|
||||
foreach ($this->container->getParameter('wallabag_core.default_internal_settings') as $setting) {
|
||||
$newSetting = new Setting();
|
||||
$newSetting->setName($setting['name']);
|
||||
$newSetting->setValue($setting['value']);
|
||||
$newSetting->setSection($setting['section']);
|
||||
$manager->persist($newSetting);
|
||||
}
|
||||
|
||||
$manager->flush();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user