em->getConnection()->getDatabase())) { throw new \RuntimeException("The DB name shall contain 'test' in its name to be purge"); } $this->em->getConnection()->exec('SET FOREIGN_KEY_CHECKS = 0;'); $purger = new ORMPurger($this->em); $purger->setPurgeMode(ORMPurger::PURGE_MODE_DELETE); $purger->purge(); $this->em->getConnection()->exec('SET FOREIGN_KEY_CHECKS = 1;'); } public function load(ObjectManager $em): void { // purge DB $this->em = $em; $this->purgeDb(); // create an organization with a network, legal status accesses, Param , name, id and settings $network = new Network(); $network->setName('NET'); $em->persist($network); $contactPoint0 = new ContactPoint(); $contactPoint0->setContactType(ContactPointTypeEnum::PRINCIPAL()->getValue()); $em->persist($contactPoint0); // Create the root organization (opentalent) $root = new Organization(); $root->setName('Root'); $root->setLegalStatus(LegalEnum::COMMERCIAL_SOCIETY()->getValue()); $root->setPrincipalType(PrincipalTypeEnum::NATIONAL_FEDERATION()->getValue()); $root->addContactPoint($contactPoint0); // subdomain fixtures $subdomain = new Subdomain(); $subdomain->setOrganization($root); $subdomain->setSubdomain('subdomain'); $subdomain->setActive(true); $parameters = new Parameters(); $parameters->setFinancialDate(new DateTime()); $parameters->setMusicalDate(new DateTime()); $parameters->setStartCourseDate(new DateTime()); $parameters->setEndCourseDate(new DateTime()); $parameters->setAverage(20); $parameters->setEditCriteriaNotationByAdminOnly(true); $parameters->setSmsSenderName('MySender'); $parameters->setLogoDonorsMove(false); $parameters->setSubDomain('subdomain'); $parameters->setWebsite('https://www.example.com'); $parameters->setOtherWebsite('https://www.otherwebsite.com'); $parameters->setCustomDomain('https://www.customdomain.com'); $parameters->setDesactivateOpentalentSiteWeb(false); $parameters->setBulletinPeriod('SomePeriod'); $parameters->setBulletinWithTeacher(false); $parameters->setBulletinPrintAddress(false); $parameters->setBulletinSignatureDirector(true); $parameters->setBulletinDisplayLevelAcquired(true); $parameters->setBulletinShowEducationWithoutEvaluation(false); $parameters->setBulletinViewTestResults(false); $parameters->setBulletinShowAbsences(false); $parameters->setBulletinShowAverages(true); $parameters->setBulletinOutput('SomeOutput'); $parameters->setBulletinEditWithoutEvaluation(true); $parameters->setBulletinReceiver('STUDENTS_AND_THEIR_GUARDIANS'); $parameters->setBulletinCriteriaSort('BY_CRITERIA_INSERT'); $parameters->setUsernameSMS('username'); $parameters->setPasswordSMS('password'); $parameters->setShowAdherentList(true); $parameters->setStudentsAreAdherents(false); $parameters->setTimezone('Europe/Paris'); $parameters->setEducationPeriodicity('ANNUAL'); $parameters->setAdvancedEducationNotationType('BY_EDUCATION'); $parameters->setSendAttendanceEmail(false); $parameters->setSendAttendanceSms(false); $parameters->setGenerateAttendanceReport(true); $parameters->setConsultPedagogicResult(true); $parameters->setConsultTeacherListing(true); $parameters->setPeriodValidation(true); $parameters->setNotifyAdministrationAbsence(false); $root->setParameters($parameters); $settings = new Settings(); $settings->setProduct('school'); $settings->setModules(['BillingAdministration']); $root->setSettings($settings); //create acesses with orga $access = new Access(); $access->setOrganization($root); $access->setRoles(["ROLE_ADMIN","ROLE_ADMIN_CORE","ROLE_SUPER_ADMIN"]); $teacherAccess = new Access(); $teacherAccess->setOrganization($root); $teacherAccess->setRoles(["ROLE_TEACHER"]); // create a person : $person = new Person(); $person->addAccess($access); $person->setUsername('username'); $person->setPassword('password'); // create BillingSetting with an organization $billingSetting = new BillingSetting(); $billingSetting->setOrganization($root); $em->persist($billingSetting); $residenceArea = new ResidenceArea(); $residenceArea->setLabel('label'); $residenceArea->setBillingSetting($billingSetting); //create an AccessBilling with an access $accessBilling = new AccessBilling(); $accessBilling->setAccess($access); $accessBilling->setResidenceArea($residenceArea); $education = new Education(); $educationCurriculum = new EducationCurriculum(); $cycleByEducation = new CycleByEducation(); $cycle = new Cycle(); $cycle->setOrganization($root); $cycle->setLabel('cycle'); $cycle->setCycleEnum('CYCLE_1'); $cycle->setIsSystem(false); $cycle->addCycleByEducation($cycleByEducation); // Booking $now = new \DateTime('now'); $start = $now->add(new \DateInterval('P1M')); $end = $now->add(new \DateInterval('P1M1D')); $event = new Event(); $event->setOrganization($root); $event->setName('My Event'); $event->setDatetimeStart($start); $event->setDatetimeEnd($end); $event->setVisibility(VisibilityEnum::PUBLIC_VISIBILITY()); $event->setUuid(Uuid::uuid()); $em->persist($root); $em->persist($event); $em->persist($person); $em->persist($access); $em->persist($accessBilling); $em->persist($billingSetting); $em->persist($residenceArea); $em->persist($subdomain); $em->persist($parameters); $em->flush(); } }