|
@@ -120,16 +120,32 @@ class SubdomainService
|
|
|
$subdomain->setOrganization($organization);
|
|
$subdomain->setOrganization($organization);
|
|
|
$subdomain->setActive(false);
|
|
$subdomain->setActive(false);
|
|
|
|
|
|
|
|
- $this->em->persist($subdomain);
|
|
|
|
|
- $this->em->flush();
|
|
|
|
|
|
|
+ $this->em->beginTransaction();
|
|
|
|
|
|
|
|
- // Register into the BindFile (takes up to 5min to take effect)
|
|
|
|
|
- $this->bindFileService->registerSubdomain($subdomain->getSubdomain());
|
|
|
|
|
|
|
+ try {
|
|
|
|
|
|
|
|
- if ($activate) {
|
|
|
|
|
- $subdomain = $this->activateSubdomain($subdomain);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // <--- Pour la rétrocompatibilité avec la v1; pourra être supprimé lorsque la migration sera achevée
|
|
|
|
|
+ $parameters = $organization->getParameters();
|
|
|
|
|
+ $parameters->setSubDomain($subdomainValue);
|
|
|
|
|
+ $parameters->setOtherWebsite('https://' . $subdomainValue . '.opentalent.fr');
|
|
|
|
|
+ $this->em->persist($parameters);
|
|
|
|
|
+ // --->
|
|
|
|
|
+
|
|
|
|
|
+ $this->em->persist($subdomain);
|
|
|
|
|
+ $this->em->flush();
|
|
|
|
|
+
|
|
|
|
|
+ // Register into the BindFile (takes up to 5min to take effect)
|
|
|
|
|
+ $this->bindFileService->registerSubdomain($subdomain->getSubdomain());
|
|
|
|
|
|
|
|
|
|
+ if ($activate) {
|
|
|
|
|
+ $subdomain = $this->activateSubdomain($subdomain);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $this->em->commit();
|
|
|
|
|
+ } catch (\Throwable $e) {
|
|
|
|
|
+ $this->em->rollback();
|
|
|
|
|
+ throw $e;
|
|
|
|
|
+ }
|
|
|
return $subdomain;
|
|
return $subdomain;
|
|
|
}
|
|
}
|
|
|
|
|
|