Files
Coltura/src/DataFixtures/AppFixtures.php
Matthieu 4c9040c923 feat : init project Coltura (CRM/ERP)
Symfony 8 + API Platform 4 + Nuxt 4 monorepo.
Backend: User entity, JWT auth, fixtures.
Frontend: login, dashboard, auth middleware, i18n, @malio/layer-ui.
Docker: dev (ports 8083/3003/5436) + prod multi-stage.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 10:56:57 +02:00

41 lines
1.1 KiB
PHP

<?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);
$alice = new User();
$alice->setUsername('alice');
$alice->setRoles(['ROLE_USER']);
$alice->setPassword($this->passwordHasher->hashPassword($alice, 'alice'));
$manager->persist($alice);
$bob = new User();
$bob->setUsername('bob');
$bob->setRoles(['ROLE_USER']);
$bob->setPassword($this->passwordHasher->hashPassword($bob, 'bob'));
$manager->persist($bob);
$manager->flush();
}
}