2015-02-22 14:35:36 +01:00
|
|
|
<?php
|
|
|
|
|
2024-02-19 01:30:12 +01:00
|
|
|
namespace Wallabag\DataFixtures;
|
2015-02-22 14:35:36 +01:00
|
|
|
|
2018-11-26 20:00:01 +01:00
|
|
|
use Doctrine\Bundle\FixturesBundle\Fixture;
|
|
|
|
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
|
2020-06-15 08:25:59 +02:00
|
|
|
use Doctrine\Persistence\ObjectManager;
|
2024-02-19 01:30:12 +01:00
|
|
|
use Wallabag\Entity\Config;
|
|
|
|
use Wallabag\Entity\User;
|
2015-02-22 14:35:36 +01:00
|
|
|
|
2018-11-26 20:00:01 +01:00
|
|
|
class ConfigFixtures extends Fixture implements DependentFixtureInterface
|
2015-02-22 14:35:36 +01:00
|
|
|
{
|
2020-06-15 08:25:59 +02:00
|
|
|
public function load(ObjectManager $manager): void
|
2015-02-22 14:35:36 +01:00
|
|
|
{
|
2023-08-05 18:25:03 +02:00
|
|
|
$adminConfig = new Config($this->getReference('admin-user', User::class));
|
2015-11-13 21:23:39 +01:00
|
|
|
|
2015-02-22 14:35:36 +01:00
|
|
|
$adminConfig->setItemsPerPage(30);
|
2019-07-08 14:45:45 +02:00
|
|
|
$adminConfig->setReadingSpeed(200);
|
2015-12-29 09:59:46 +01:00
|
|
|
$adminConfig->setLanguage('en');
|
2016-09-16 22:22:25 +02:00
|
|
|
$adminConfig->setPocketConsumerKey('xxxxx');
|
2016-11-06 12:02:39 +01:00
|
|
|
$adminConfig->setActionMarkAsRead(0);
|
2016-12-12 17:41:03 +01:00
|
|
|
$adminConfig->setListMode(0);
|
2023-06-13 15:02:48 +02:00
|
|
|
$adminConfig->setDisplayThumbnails(0);
|
2015-02-22 14:35:36 +01:00
|
|
|
|
|
|
|
$manager->persist($adminConfig);
|
|
|
|
|
|
|
|
$this->addReference('admin-config', $adminConfig);
|
|
|
|
|
2023-08-05 18:25:03 +02:00
|
|
|
$bobConfig = new Config($this->getReference('bob-user', User::class));
|
2015-02-22 14:35:36 +01:00
|
|
|
$bobConfig->setItemsPerPage(10);
|
2019-07-08 14:45:45 +02:00
|
|
|
$bobConfig->setReadingSpeed(200);
|
2015-12-29 09:59:46 +01:00
|
|
|
$bobConfig->setLanguage('fr');
|
2016-09-16 22:22:25 +02:00
|
|
|
$bobConfig->setPocketConsumerKey(null);
|
2016-11-06 12:02:39 +01:00
|
|
|
$bobConfig->setActionMarkAsRead(1);
|
2016-12-12 17:41:03 +01:00
|
|
|
$bobConfig->setListMode(1);
|
2023-06-13 15:02:48 +02:00
|
|
|
$bobConfig->setDisplayThumbnails(1);
|
2015-02-22 14:35:36 +01:00
|
|
|
|
|
|
|
$manager->persist($bobConfig);
|
|
|
|
|
|
|
|
$this->addReference('bob-config', $bobConfig);
|
|
|
|
|
2023-08-05 18:25:03 +02:00
|
|
|
$emptyConfig = new Config($this->getReference('empty-user', User::class));
|
2016-01-09 14:34:49 +01:00
|
|
|
$emptyConfig->setItemsPerPage(10);
|
2022-03-02 19:11:32 +01:00
|
|
|
$emptyConfig->setReadingSpeed(100);
|
2016-01-09 14:34:49 +01:00
|
|
|
$emptyConfig->setLanguage('en');
|
2016-09-16 22:22:25 +02:00
|
|
|
$emptyConfig->setPocketConsumerKey(null);
|
2016-11-06 12:02:39 +01:00
|
|
|
$emptyConfig->setActionMarkAsRead(0);
|
2016-12-12 17:41:03 +01:00
|
|
|
$emptyConfig->setListMode(0);
|
2023-06-13 15:02:48 +02:00
|
|
|
$emptyConfig->setDisplayThumbnails(0);
|
2016-01-09 14:34:49 +01:00
|
|
|
|
|
|
|
$manager->persist($emptyConfig);
|
|
|
|
|
|
|
|
$this->addReference('empty-config', $emptyConfig);
|
|
|
|
|
2015-02-22 14:35:36 +01:00
|
|
|
$manager->flush();
|
|
|
|
}
|
|
|
|
|
2018-11-26 20:00:01 +01:00
|
|
|
public function getDependencies()
|
2015-02-22 14:35:36 +01:00
|
|
|
{
|
2018-11-26 20:00:01 +01:00
|
|
|
return [
|
|
|
|
UserFixtures::class,
|
|
|
|
];
|
2015-02-22 14:35:36 +01:00
|
|
|
}
|
|
|
|
}
|