2015-02-22 14:35:36 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Wallabag\CoreBundle\DataFixtures\ORM;
|
|
|
|
|
|
|
|
use Doctrine\Common\DataFixtures\AbstractFixture;
|
|
|
|
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
|
|
|
|
use Doctrine\Common\Persistence\ObjectManager;
|
|
|
|
use Wallabag\CoreBundle\Entity\Config;
|
2015-11-13 21:23:39 +01:00
|
|
|
use Wallabag\CoreBundle\Entity\TaggingRule;
|
2015-02-22 14:35:36 +01:00
|
|
|
|
|
|
|
class LoadConfigData extends AbstractFixture implements OrderedFixtureInterface
|
|
|
|
{
|
|
|
|
/**
|
2015-08-20 07:53:55 +02:00
|
|
|
* {@inheritdoc}
|
2015-02-22 14:35:36 +01:00
|
|
|
*/
|
|
|
|
public function load(ObjectManager $manager)
|
|
|
|
{
|
|
|
|
$adminConfig = new Config($this->getReference('admin-user'));
|
2015-11-13 21:23:39 +01:00
|
|
|
$taggingRule = new TaggingRule();
|
|
|
|
|
|
|
|
$taggingRule->setConfig($adminConfig);
|
|
|
|
$taggingRule->setRule('title matches "wallabag"');
|
|
|
|
$taggingRule->setTags(['wallabag']);
|
|
|
|
$manager->persist($taggingRule);
|
|
|
|
|
2015-08-04 22:51:21 +02:00
|
|
|
$adminConfig->setTheme('material');
|
2015-02-22 14:35:36 +01:00
|
|
|
$adminConfig->setItemsPerPage(30);
|
2015-12-29 09:59:46 +01:00
|
|
|
$adminConfig->setLanguage('en');
|
2015-02-22 14:35:36 +01:00
|
|
|
|
|
|
|
$manager->persist($adminConfig);
|
|
|
|
|
|
|
|
$this->addReference('admin-config', $adminConfig);
|
|
|
|
|
|
|
|
$bobConfig = new Config($this->getReference('bob-user'));
|
|
|
|
$bobConfig->setTheme('default');
|
|
|
|
$bobConfig->setItemsPerPage(10);
|
2015-12-29 09:59:46 +01:00
|
|
|
$bobConfig->setLanguage('fr');
|
2015-02-22 14:35:36 +01:00
|
|
|
|
|
|
|
$manager->persist($bobConfig);
|
|
|
|
|
|
|
|
$this->addReference('bob-config', $bobConfig);
|
|
|
|
|
|
|
|
$manager->flush();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2015-08-20 07:53:55 +02:00
|
|
|
* {@inheritdoc}
|
2015-02-22 14:35:36 +01:00
|
|
|
*/
|
|
|
|
public function getOrder()
|
|
|
|
{
|
|
|
|
return 20;
|
|
|
|
}
|
|
|
|
}
|