Commit cc6cff8a authored by Laurent Lecluse's avatar Laurent Lecluse
Browse files

Meilleure gestion des NULL

parent 4c59b87e
Loading
Loading
Loading
Loading
+14 −4
Original line number Diff line number Diff line
@@ -338,12 +338,21 @@ class Table
                    $whereSql .= ' AND ';
                }

                $transVal = ':' . $c;

                if (isset($options['columns'][$c]['transformer'])) {
                    $transVal = ':' . $c;
                    $transVal = '(' . sprintf($options['columns'][$c]['transformer'], $transVal) . ')';
                }
                    $whereSql   .= $c . ' = ' . $transVal;
                    $params[$c] = $v;
                }else{
                    if ($v === null){
                        $whereSql   .= $c . ' IS NULL';
                    }else{
                        $transVal = ':' . $c;
                        $whereSql   .= $c . ' = ' . $transVal;
                        $params[$c] = $v;
                    }
                }
            }

            return ' WHERE ' . $whereSql;
@@ -406,6 +415,7 @@ class Table
            case 'CLOB':
                return $value;
            case 'DATE':
                if (!$value) return null;
                $date = \DateTime::createFromFormat('Y-m-d', $value);
                $date->setTime(0, 0, 0);