You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
845 B
32 lines
845 B
6 years ago
|
<?php
|
||
|
|
||
|
namespace App\DataFixtures;
|
||
|
|
||
|
use App\Entity\User;
|
||
|
use Doctrine\Bundle\FixturesBundle\Fixture;
|
||
|
use Doctrine\Common\Persistence\ObjectManager;
|
||
|
|
||
|
class UserFixtures extends Fixture
|
||
|
{
|
||
|
public const ADMIN_USER_REFERENCE = 'admin-user';
|
||
|
public const DUMMY_USER_REFERENCE = 'dummy-user';
|
||
|
|
||
|
public function load(ObjectManager $manager)
|
||
|
{
|
||
|
$userAdmin = new User();
|
||
|
$userAdmin->setName('admin');
|
||
|
$userAdmin->setPassword('123456789');
|
||
|
$manager->persist($userAdmin);
|
||
|
|
||
|
$userDummy = new User();
|
||
|
$userDummy->setName('dummy');
|
||
|
$userDummy->setPassword('1234');
|
||
|
$manager->persist($userDummy);
|
||
|
|
||
|
$manager->flush();
|
||
|
|
||
|
$this->addReference(self::ADMIN_USER_REFERENCE, $userAdmin);
|
||
|
$this->addReference(self::DUMMY_USER_REFERENCE, $userDummy);
|
||
|
}
|
||
|
}
|