diff --git a/manager/ORM/Rows.php b/manager/ORM/Rows.php index 2eff639..6ab872e 100644 --- a/manager/ORM/Rows.php +++ b/manager/ORM/Rows.php @@ -702,14 +702,12 @@ $requestS = SQLBuilder::SELECT($selectTables)."\n"; - /* [2] On rédige la clause FROM ========================================================*/ /* (1) Table locale */ $requestS .= SQLBuilder::FROM( array_keys($selectTables) )."\n"; - /* [5] On rédige la clause WHERE/AND =========================================================*/ /* (0) On initialise le conteneur des variables "bindés" */ @@ -730,9 +728,11 @@ } /* (2) On ajoute les jointures */ - foreach($this->joined as $localField=>$rows) + foreach($this->joined as $localField=>$rows){ if( $c == 0 ) $requestS .= 'WHERE '.$this->schema['table'].'.'.$localField.' = '.$this->schema['columns'][$localField]['references'][0].'.'.$this->schema['columns'][$localField]['references'][1]."\n"; else $requestS .= 'AND '.$this->schema['table'].'.'.$localField.' = '.$this->schema['columns'][$localField]['references'][0].'.'.$this->schema['columns'][$localField]['references'][1]."\n"; + $c++; + } /* (3) On ajoute les conditions des jointures */ foreach($this->joined as $rows) diff --git a/test/automate.php b/test/automate.php index 11fadce..28b41df 100755 --- a/test/automate.php +++ b/test/automate.php @@ -433,17 +433,17 @@ // // ->delete(); // - // $module = Table::get('module') - // ->whereName([ $_SESSION['WAREHOUSE']['modules'], Rows::COND_IN ]); - // - // $chip = Table::get('chip') - // ->select('*'); - // - // $module_merge = Table::get('module_merge') - // ->join('id_module', $module) - // ->join('id_chip', $chip); - // - // var_dump($module_merge->fetch()); + $module = Table::get('module') + ->whereName([ $_SESSION['WAREHOUSE']['modules'], Rows::COND_IN ]); + + $chip = Table::get('chip') + ->select('*'); + + $module_merge = Table::get('module_merge') + ->join('id_module', $module); + // ->join('id_chip', $chip); + + var_dump($module_merge->fetch()); ?>