2016-01-21 11:23:45 +00:00
|
|
|
<?php
|
|
|
|
|
2024-02-19 00:30:12 +00:00
|
|
|
namespace Wallabag\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;
|
2024-02-19 00:30:12 +00:00
|
|
|
use Wallabag\Entity\InternalSetting;
|
2016-01-21 11:23:45 +00:00
|
|
|
|
2025-01-18 13:16:49 +00:00
|
|
|
class InternalSettingFixtures extends Fixture
|
2016-01-21 11:23:45 +00:00
|
|
|
{
|
2025-01-18 13:16:49 +00:00
|
|
|
private array $defaultInternalSettings;
|
2017-06-02 08:19:33 +00:00
|
|
|
|
2025-01-18 13:16:49 +00:00
|
|
|
public function __construct(array $defaultInternalSettings)
|
2017-06-02 08:19:33 +00:00
|
|
|
{
|
2025-01-18 13:16:49 +00:00
|
|
|
$this->defaultInternalSettings = $defaultInternalSettings;
|
2017-06-02 08:19:33 +00:00
|
|
|
}
|
|
|
|
|
2020-06-15 06:25:59 +00:00
|
|
|
public function load(ObjectManager $manager): void
|
2016-01-21 11:23:45 +00:00
|
|
|
{
|
2025-01-18 13:16:49 +00:00
|
|
|
foreach ($this->defaultInternalSettings 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();
|
|
|
|
}
|
|
|
|
}
|