feat : init Central project — Symfony 8 + Nuxt 4 + Docker starter
Same architecture as Lesstime: API Platform 4, JWT auth, @malio/layer-ui, PostgreSQL 16, Docker Compose (ports 8083/3003/5436), dark mode theme. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
40
src/DataFixtures/AppFixtures.php
Normal file
40
src/DataFixtures/AppFixtures.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\DataFixtures;
|
||||
|
||||
use App\Entity\User;
|
||||
use Doctrine\Bundle\FixturesBundle\Fixture;
|
||||
use Doctrine\Persistence\ObjectManager;
|
||||
use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface;
|
||||
|
||||
class AppFixtures extends Fixture
|
||||
{
|
||||
public function __construct(
|
||||
private readonly UserPasswordHasherInterface $passwordHasher,
|
||||
) {}
|
||||
|
||||
public function load(ObjectManager $manager): void
|
||||
{
|
||||
$admin = new User();
|
||||
$admin->setUsername('admin');
|
||||
$admin->setRoles(['ROLE_ADMIN']);
|
||||
$admin->setPassword($this->passwordHasher->hashPassword($admin, 'admin'));
|
||||
$manager->persist($admin);
|
||||
|
||||
$userAlice = new User();
|
||||
$userAlice->setUsername('alice');
|
||||
$userAlice->setRoles(['ROLE_USER']);
|
||||
$userAlice->setPassword($this->passwordHasher->hashPassword($userAlice, 'alice'));
|
||||
$manager->persist($userAlice);
|
||||
|
||||
$userBob = new User();
|
||||
$userBob->setUsername('bob');
|
||||
$userBob->setRoles(['ROLE_USER']);
|
||||
$userBob->setPassword($this->passwordHasher->hashPassword($userBob, 'bob'));
|
||||
$manager->persist($userBob);
|
||||
|
||||
$manager->flush();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user