|
|
@@ -2,6 +2,7 @@
|
|
|
|
|
|
namespace App\Service\OnChange\Organization;
|
|
|
|
|
|
+use App\Entity\Organization\Organization;
|
|
|
use App\Entity\Organization\Subdomain;
|
|
|
use App\Message\Command\MailerCommand;
|
|
|
use App\Message\Command\Typo3\Typo3UpdateCommand;
|
|
|
@@ -13,6 +14,7 @@ use App\Service\OnChange\OnChangeDefault;
|
|
|
use App\Service\Organization\Utils as OrganizationUtils;
|
|
|
use App\Service\Typo3\BindFileService;
|
|
|
use App\Tests\Service\OnChange\Organization\OnSubdomainChangeTest;
|
|
|
+use Doctrine\ORM\EntityManagerInterface;
|
|
|
use Symfony\Component\Messenger\MessageBusInterface;
|
|
|
use Symfony\Component\Security\Core\Security;
|
|
|
|
|
|
@@ -22,7 +24,8 @@ class OnSubdomainChange extends OnChangeDefault
|
|
|
private OrganizationUtils $organizationUtils,
|
|
|
private BindFileService $bindFileService,
|
|
|
private MessageBusInterface $messageBus,
|
|
|
- private Security $security
|
|
|
+ private Security $security,
|
|
|
+ private EntityManagerInterface $em
|
|
|
) {}
|
|
|
|
|
|
/** @noinspection PhpParameterNameChangedDuringInheritanceInspection */
|
|
|
@@ -51,7 +54,6 @@ class OnSubdomainChange extends OnChangeDefault
|
|
|
|
|
|
/** @noinspection PhpParameterNameChangedDuringInheritanceInspection */
|
|
|
public function onChange($subdomain, OnChangeContext $context): void {
|
|
|
-
|
|
|
// Register into the BindFile
|
|
|
if ($context->isPostRequest()) {
|
|
|
$this->bindFileService->registerSubdomain($subdomain->getSubdomain());
|
|
|
@@ -60,6 +62,8 @@ class OnSubdomainChange extends OnChangeDefault
|
|
|
// A new subdomain is active
|
|
|
// /!\ This has to be executed after everything has been persisted
|
|
|
if ($subdomain->isActive() && !($context->previousData() && $context->previousData()->isActive())) {
|
|
|
+ // TODO: comprendre pourquoi ce refresh est indispensable pour le l'organisation soit à jour
|
|
|
+ $this->em->refresh($subdomain->getOrganization());
|
|
|
|
|
|
// Update the typo3 website (asynchronously with messenger)
|
|
|
$this->messageBus->dispatch(
|