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