2016-01-21 12:23:45 +01:00
|
|
|
<?php
|
|
|
|
|
2024-02-19 01:30:12 +01:00
|
|
|
namespace Wallabag\DataFixtures;
|
2016-01-21 12:23:45 +01:00
|
|
|
|
2018-11-26 20:00:01 +01:00
|
|
|
use Doctrine\Bundle\FixturesBundle\Fixture;
|
2020-06-15 08:25:59 +02:00
|
|
|
use Doctrine\Persistence\ObjectManager;
|
2024-02-19 01:30:12 +01:00
|
|
|
use Wallabag\Entity\InternalSetting;
|
2016-01-21 12:23:45 +01:00
|
|
|
|
2025-01-18 14:16:49 +01:00
|
|
|
class InternalSettingFixtures extends Fixture
|
2016-01-21 12:23:45 +01:00
|
|
|
{
|
2025-01-18 14:16:49 +01:00
|
|
|
private array $defaultInternalSettings;
|
2017-06-02 10:19:33 +02:00
|
|
|
|
2025-01-18 14:16:49 +01:00
|
|
|
public function __construct(array $defaultInternalSettings)
|
2017-06-02 10:19:33 +02:00
|
|
|
{
|
2025-01-18 14:16:49 +01:00
|
|
|
$this->defaultInternalSettings = $defaultInternalSettings;
|
2017-06-02 10:19:33 +02:00
|
|
|
}
|
|
|
|
|
2020-06-15 08:25:59 +02:00
|
|
|
public function load(ObjectManager $manager): void
|
2016-01-21 12:23:45 +01:00
|
|
|
{
|
2025-01-18 14:16:49 +01:00
|
|
|
foreach ($this->defaultInternalSettings as $setting) {
|
2019-08-08 15:19:53 +02:00
|
|
|
$newSetting = new InternalSetting();
|
2016-01-21 12:23:45 +01:00
|
|
|
$newSetting->setName($setting['name']);
|
|
|
|
$newSetting->setValue($setting['value']);
|
|
|
|
$newSetting->setSection($setting['section']);
|
|
|
|
$manager->persist($newSetting);
|
|
|
|
}
|
|
|
|
|
|
|
|
$manager->flush();
|
|
|
|
}
|
|
|
|
}
|