This commit is contained in:
2022-10-16 10:36:53 +02:00
parent 85125c7d6b
commit 0f3447adf5
27 changed files with 1183 additions and 75 deletions

View File

@ -0,0 +1,38 @@
<?php
namespace App\DataFixtures;
use App\Entity\User;
use Doctrine\Bundle\FixturesBundle\FixtureGroupInterface;
use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Persistence\ObjectManager;
class UserFixtures extends Fixture implements FixtureGroupInterface
{
private $passwordEncoder;
public function __construct(UserPasswordHasherInterface $passwordEncoder)
{
$this->passwordEncoder = $passwordEncoder;
}
public function load(ObjectManager $manager)
{
$user = new User();
$user->setPassword($this->passwordEncoder->hashPassword(
$user,
"rootroot"
));
$user->setEmail("rmasson.pro@gmail.com")
->setRoles(["ROLE_USER","ROLE_ADMIN"]);
$manager->persist($user);
$manager->flush();
}
public static function getGroups(): array
{
return ['userGroup'];
}
}