Add post and species forms

Squashed commit of the following:
Author: Hugo PRADIER <Hugo.PRADIER2@etu.uca.fr>
Author: bastien ollier <bastien.ollier@etu.uca.fr>
Author: clfreville2 <clement.freville2@etu.uca.fr>
Reviewed on #7
This commit is contained in:
2024-06-07 17:49:12 +02:00
parent 82a3f69fa4
commit 49d60871c9
29 changed files with 740 additions and 86 deletions

View File

@@ -4,17 +4,29 @@ namespace App\DataFixtures;
use App\Entity\Post;
use App\Entity\Species;
use App\Entity\User;
use DateTimeImmutable;
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
{
$user = (new User())->setEmail('test@test.fr');
$user->setPassword($this->passwordHasher->hashPassword($user, 'password'));
$manager->persist($user);
$faker = \Faker\Factory::create();
for ($i = 0; $i < 20; ++$i) {
$name = $faker->text();
$name = $faker->name();
$species = (new Species())
->setScientificName($name)
->setVernacularName($name)