From f4271043c8d9a68e94d1216e244402fc8104c2d7 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Mon, 25 Sep 2017 23:21:42 +0200 Subject: [PATCH] Fixed according to *SATS* api/sync log --- build/database/repo/chip.php | 24 +++++++++++------------- build/database/repo/state.php | 1 + 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/build/database/repo/chip.php b/build/database/repo/chip.php index 228ab18..1a85c66 100755 --- a/build/database/repo/chip.php +++ b/build/database/repo/chip.php @@ -41,14 +41,18 @@ $mods = $get_mods->answer(); - // si pas déja -> on ajoute l'id module à la liste - if( is_array($mods) && !in_array($mods['id_module'], $module_ids) ) - $module_ids[] = $mods['id_module']; + foreach($mods as $module){ + + // si pas déja -> on ajoute l'id module à la liste + if( !in_array($module['id_module'], $module_ids) ) + $module_ids[] = $module['id_module']; + + } } - /* (3) On récupère la liste des CHIPS + /* (3) On récupère la liste des CHIPS (associés aux modules) ---------------------------------------------------------*/ $chips = []; foreach($module_ids as $module_id){ @@ -59,22 +63,16 @@ $fetched = $chip_req->fetch(); - // only one by ids - $chips[$fetched['id_chip']] = $fetched; + foreach($fetched as $chip) + $chips[] = $chip; } - $chip = Table::get('chip') - ->join('id_module', $module_merge) - ->select('*'); - - - /* [2] On retourne le résultat =========================================================*/ - return $chip->fetch(); + return $chips; } } diff --git a/build/database/repo/state.php b/build/database/repo/state.php index ae9160d..47c5c0d 100755 --- a/build/database/repo/state.php +++ b/build/database/repo/state.php @@ -4,6 +4,7 @@ use \database\core\DatabaseDriver; use \database\core\Repo; use \manager\repo\cluster as clusterRepo; + use \orm\core\Table; class state extends parentRepo{