mirror of
https://github.com/wallabag/wallabag.git
synced 2025-08-21 18:11:10 +00:00
Improve install command & add test
Also add fixtures for Config InstallCommand now check if database, schema are here and ask the user what to do (keep or trash & re-create)
This commit is contained in:
parent
0bd2cb1ecd
commit
0bf99bb144
4 changed files with 333 additions and 83 deletions
45
src/Wallabag/CoreBundle/DataFixtures/ORM/LoadConfigData.php
Normal file
45
src/Wallabag/CoreBundle/DataFixtures/ORM/LoadConfigData.php
Normal file
|
@ -0,0 +1,45 @@
|
|||
<?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;
|
||||
|
||||
class LoadConfigData extends AbstractFixture implements OrderedFixtureInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function load(ObjectManager $manager)
|
||||
{
|
||||
$adminConfig = new Config($this->getReference('admin-user'));
|
||||
$adminConfig->setTheme('baggy');
|
||||
$adminConfig->setItemsPerPage(30);
|
||||
$adminConfig->setLanguage('en_US');
|
||||
|
||||
$manager->persist($adminConfig);
|
||||
|
||||
$this->addReference('admin-config', $adminConfig);
|
||||
|
||||
$bobConfig = new Config($this->getReference('bob-user'));
|
||||
$bobConfig->setTheme('default');
|
||||
$bobConfig->setItemsPerPage(10);
|
||||
$bobConfig->setLanguage('fr_FR');
|
||||
|
||||
$manager->persist($bobConfig);
|
||||
|
||||
$this->addReference('bob-config', $bobConfig);
|
||||
|
||||
$manager->flush();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getOrder()
|
||||
{
|
||||
return 20;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue