From 1bdfed869e872f2ab59ef979a95d2557a7bef9f5 Mon Sep 17 00:00:00 2001
From: Jean-Philippe Metivier <jean-philippe.metivier@unicaen.fr>
Date: Wed, 29 May 2024 11:08:27 +0200
Subject: [PATCH] =?UTF-8?q?Ajout=20message=20d'erreur=20=C3=A0=20propos=20?=
 =?UTF-8?q?des=20ORM=20manquant?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../Service/Synchronisation/SynchronisationService.php | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/UnicaenSynchro/Service/Synchronisation/SynchronisationService.php b/src/UnicaenSynchro/Service/Synchronisation/SynchronisationService.php
index b9981b9..d496faf 100644
--- a/src/UnicaenSynchro/Service/Synchronisation/SynchronisationService.php
+++ b/src/UnicaenSynchro/Service/Synchronisation/SynchronisationService.php
@@ -78,7 +78,17 @@ class SynchronisationService
 
             $correspondance    = $this->getFromConfig($name, 'correspondance');
             $orm_source        = $this->entityManagers[$this->getFromConfig($name, 'orm_source')];
+            if ($orm_source === null) {
+                echo "\033[31m\033[1mPas d'ORM source\033[0m\n";
+                echo "La synchronisation [".$name."] n'a pas d'ORM source [".$this->getFromConfig($name, 'orm_source')."]\n";
+                exit(404);
+            }
             $orm_destination   = $this->entityManagers[$this->getFromConfig($name, 'orm_destination')];
+            if ($orm_destination === null) {
+                echo "\033[31m\033[1mPas d'ORM destination\033[0m\n";
+                echo "La synchronisation [".$name."] n'a pas d'ORM destination [".$this->getFromConfig($name, 'orm_destination')."]\n";
+                exit(404);
+            }
             $table_source      = $this->getFromConfig($name, 'table_source');
             $table_destination = $this->getFromConfig($name, 'table_destination');
             $id_source         = $this->getFromConfig($name, 'id');
-- 
GitLab