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