2015-02-08 23:05:51 +01:00
|
|
|
<?php
|
|
|
|
|
2015-10-02 14:51:41 +02:00
|
|
|
namespace Wallabag\UserBundle\DataFixtures\ORM;
|
2015-02-08 23:05:51 +01:00
|
|
|
|
|
|
|
use Doctrine\Common\DataFixtures\AbstractFixture;
|
|
|
|
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
|
|
|
|
use Doctrine\Common\Persistence\ObjectManager;
|
2015-10-02 14:51:41 +02:00
|
|
|
use Wallabag\UserBundle\Entity\User;
|
2015-02-08 23:05:51 +01:00
|
|
|
|
|
|
|
class LoadUserData extends AbstractFixture implements OrderedFixtureInterface
|
|
|
|
{
|
|
|
|
/**
|
2015-08-20 07:53:55 +02:00
|
|
|
* {@inheritdoc}
|
2015-02-08 23:05:51 +01:00
|
|
|
*/
|
|
|
|
public function load(ObjectManager $manager)
|
|
|
|
{
|
|
|
|
$userAdmin = new User();
|
2015-02-10 22:32:42 +01:00
|
|
|
$userAdmin->setName('Big boss');
|
|
|
|
$userAdmin->setEmail('bigboss@wallabag.org');
|
2015-02-08 23:05:51 +01:00
|
|
|
$userAdmin->setUsername('admin');
|
2015-09-29 14:31:52 +02:00
|
|
|
$userAdmin->setPlainPassword('mypassword');
|
2015-08-18 11:08:45 +02:00
|
|
|
$userAdmin->setEnabled(true);
|
2015-09-29 14:31:52 +02:00
|
|
|
$userAdmin->addRole('ROLE_SUPER_ADMIN');
|
2015-02-08 23:05:51 +01:00
|
|
|
|
|
|
|
$manager->persist($userAdmin);
|
|
|
|
|
|
|
|
$this->addReference('admin-user', $userAdmin);
|
2015-02-10 22:32:42 +01:00
|
|
|
|
|
|
|
$bobUser = new User();
|
|
|
|
$bobUser->setName('Bobby');
|
|
|
|
$bobUser->setEmail('bobby@wallabag.org');
|
|
|
|
$bobUser->setUsername('bob');
|
2015-09-29 14:31:52 +02:00
|
|
|
$bobUser->setPlainPassword('mypassword');
|
2015-08-18 11:08:45 +02:00
|
|
|
$bobUser->setEnabled(true);
|
2015-02-10 22:32:42 +01:00
|
|
|
|
|
|
|
$manager->persist($bobUser);
|
|
|
|
|
|
|
|
$this->addReference('bob-user', $bobUser);
|
|
|
|
|
2016-01-09 14:34:49 +01:00
|
|
|
$emptyUser = new User();
|
|
|
|
$emptyUser->setName('Empty');
|
|
|
|
$emptyUser->setEmail('empty@wallabag.org');
|
|
|
|
$emptyUser->setUsername('empty');
|
|
|
|
$emptyUser->setPlainPassword('mypassword');
|
|
|
|
$emptyUser->setEnabled(true);
|
|
|
|
|
|
|
|
$manager->persist($emptyUser);
|
|
|
|
|
|
|
|
$this->addReference('empty-user', $emptyUser);
|
|
|
|
|
2015-02-10 22:32:42 +01:00
|
|
|
$manager->flush();
|
2015-02-08 23:05:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2015-08-20 07:53:55 +02:00
|
|
|
* {@inheritdoc}
|
2015-02-08 23:05:51 +01:00
|
|
|
*/
|
|
|
|
public function getOrder()
|
|
|
|
{
|
|
|
|
return 10;
|
|
|
|
}
|
|
|
|
}
|