From e026bc0cc1a7e0aaf855c7e65e92d68136a9b3ac Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Sat, 23 Jul 2016 12:07:13 +0200 Subject: [PATCH] Modification fonctionnelle + test --- manager/ORM/Rows.php | 1 + test/automate.php | 13 ++++++------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/manager/ORM/Rows.php b/manager/ORM/Rows.php index 8c3263f..34d964b 100644 --- a/manager/ORM/Rows.php +++ b/manager/ORM/Rows.php @@ -10,6 +10,7 @@ /* CONSTANTES */ const COND_EQUAL = '='; + const COND_NOTEQ = '<>'; const COND_INF = '<'; const COND_SUP = '>'; const COND_INFEQ = '<='; diff --git a/test/automate.php b/test/automate.php index ead930c..1d6e3e4 100755 --- a/test/automate.php +++ b/test/automate.php @@ -344,16 +344,15 @@ $warehouse = Table::get('warehouse') // Access to table 'warehouse' - ->whereName(['s%', Rows::COND_LIKE]); // condition : name = 'my-warehouse' + ->whereName(['stef-montauban', Rows::COND_NOTEQ]); // condition : name = 'my-warehouse' $myUser = Table::get('user') // Access to table 'user' - ->whereId([3, Rows::COND_INF]) // PRIMARY KEY (if composed, all arguments in array) - // ->whereId([100, Rows::COND_INF]) // PRIMARY KEY (other condition on same field) - // ->whereUsername(['jo%', Rows::COND_LIKE]) // Dynamic getter 'getByMySuperColumn' -> 'my_super_column' - // ->select(['mail', 'username', 'firstname']) // Select clause - // ->select('id_user') // Select clause (added) + ->whereId([100, Rows::COND_INF]) // PRIMARY KEY (other condition on same field) + ->whereUsername(['jo%', Rows::COND_LIKE]) // Dynamic getter 'getByMySuperColumn' -> 'my_super_column' + ->select(['mail', 'username', 'firstname']) // Select clause + ->select('id_user') // Select clause (added) ->join('id_warehouse', $warehouse) // joins warehouse (with name 'my-warehouse') to column 'id_warehouse' // ->unique() // unique result @@ -363,7 +362,7 @@ // UPDATE ->edit([ - 'id_warehouse' => '8' + 'id_warehouse' => Table::get('warehouse')->whereName('stef-montauban')->unique()->select('id_warehouse')->fetch()['id_warehouse'] ]);