Linux SRV-16 6.18.44-paas #1 SMP PREEMPT_DYNAMIC Thu Aug 13 10:08:12 UTC 2026 x86_64
/
srv
/
data
/
web
/
vhosts
/
716cf56cb2.url-de-test.ws
/
htdocs
/
src
/
DataFixtures
/
/srv/data/web/vhosts/716cf56cb2.url-de-test.ws/htdocs/src/DataFixtures/AppFixtures.php
<?php namespace App\DataFixtures; use App\Entity\Booking; use App\Entity\Logement; use App\Entity\Option; use App\Entity\Saison; use App\Entity\User; use Doctrine\Persistence\ObjectManager; use Doctrine\Bundle\FixturesBundle\Fixture; use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface; class AppFixtures extends Fixture { protected $hasher; public function __construct(UserPasswordHasherInterface $hasher) { $this->hasher = $hasher; } public function load(ObjectManager $manager): void { $admin = new User(); $hash = $this->hasher->hashPassword($admin, "admin"); $admin->setEmail('mohamed-amine+admin@bhgroupe.fr') ->setPassword($hash) ->setRoles(['ROLE_ADMIN']) ->setFirstname("mohamed") ->setLastname("rh") ->setPhone("0123456789"); $manager->persist($admin); $users = []; for ($u = 0; $u < 5; $u++) { $user = new User(); $hash = $this->hasher->hashPassword($user, "test"); $user->setEmail("user$u@test.fr") ->setPassword($hash) ->setFirstname("mohamed" . $u) ->setLastname("rh" . $u) ->setPhone("0123456789"); $users[] = $user; $manager->persist($user); } $saison1 = new Saison(); $saison1->setName(Saison::HAUTE_SAISON) ->setStartDay(01) ->setStartMonth(06) ->setEndDay(31) ->setEndMonth(12) ->setDescription("c'est la haute saison") ->setCreatedAt(new \DateTimeImmutable()); $manager->persist($saison1); $saison2 = new Saison(); $saison2->setName(Saison::BASSE_SAISON) ->setStartDay(01) ->setStartMonth(01) ->setEndDay(30) ->setEndMonth(5) ->setDescription("c'est la basse saison") ->setCreatedAt(new \DateTimeImmutable()); $manager->persist($saison2); $option1 = new Option(); $option1->setName("Frais de ménage") ->setDescription("ce sont les frais de ménage") ->setPrice(7500) ->setCreatedAt(new \DateTimeImmutable()); $manager->persist($option1); $option2 = new Option(); $option2->setName("Draps") ->setDescription("prix pour les draps") ->setPrice(2500) ->setCreatedAt(new \DateTimeImmutable()); $manager->persist($option2); $logement1 = new Logement(); $logement1->setName("F2 1er étage") ->setPrice(10000) ->setNbLits(2) ->setNbMaxPersonnes(5) ->setAddress("7 avenue de l'orme à martin") ->setCity("Evry") ->setPostaleCode("91000") ->addOption($option1) ->setCreatedAt(new \DateTimeImmutable()); $manager->persist($logement1); $logement2 = new Logement(); $logement2->setName("F3 1er étage") ->setPrice(200000) ->setNbLits(4) ->setNbMaxPersonnes(10) ->setAddress("7 avenue de l'orme à martin") ->setCity("Evry") ->setPostaleCode("91000") ->addOption($option1) ->addOption($option2) ->setCreatedAt(new \DateTimeImmutable()); $manager->persist($logement2); $logement3 = new Logement(); $logement3->setName("Villa") ->setPrice(200000) ->setNbLits(4) ->setNbMaxPersonnes(10) ->setAddress("7 avenue de l'orme à martin") ->setCity("Evry") ->setPostaleCode("91000") ->addOption($option1) ->addOption($option2) ->setCreatedAt(new \DateTimeImmutable()); $manager->persist($logement3); $booking1 = new Booking(); $booking1->setCheckin(new \DateTimeImmutable('2024-01-10')) ->setCheckout(new \DateTimeImmutable('2024-01-23')) ->setTotalPrice(700000) ->setAdvance(500000) ->setRest(200000) ->setLogementName($logement1->getName()) ->setLogementPrice($logement1->getPrice()) ->setUserName($admin->getFirstname() . $admin->getLastname()) ->setUserPhone($admin->getPhone()) ->setSaisonName($saison1->getName()) ->setLogement($logement1) ->setUser($admin) ->setSaison($saison1); $manager->persist($booking1); $booking2 = new Booking(); $booking2->setCheckin(new \DateTimeImmutable('2023-12-15')) ->setCheckout(new \DateTimeImmutable('2023-12-23')) ->setTotalPrice(700000) ->setAdvance(500000) ->setRest(200000) ->setLogementName($logement2->getName()) ->setLogementPrice($logement2->getPrice()) ->setUserName($admin->getFirstname() . $admin->getLastname()) ->setUserPhone($admin->getPhone()) ->setSaisonName($saison2->getName()) ->setLogement($logement2) ->setUser($admin) ->setSaison($saison2); $manager->persist($booking2); $booking3 = new Booking(); $booking3->setCheckin(new \DateTimeImmutable('2023-12-10')) ->setCheckout(new \DateTimeImmutable('2023-12-19')) ->setTotalPrice(700000) ->setAdvance(500000) ->setRest(200000) ->setLogementName($logement3->getName()) ->setLogementPrice($logement3->getPrice()) ->setUserName($admin->getFirstname() . $admin->getLastname()) ->setUserPhone($admin->getPhone()) ->setSaisonName($saison2->getName()) ->setLogement($logement3) ->setUser($admin) ->setSaison($saison2); $manager->persist($booking3); $manager->flush(); } }