@@ -118,6 +118,15 @@ private static function create_required_tables() {
118118 FOREIGN KEY (site_url) REFERENCES sites(site_url)
119119 ); ' ;
120120
121+ $ query .= 'CREATE TABLE auth_users (
122+ id INTEGER,
123+ site_url VARCHAR NOT NULL,
124+ username VARCHAR NOT NULL,
125+ password VARCHAR NOT NULL,
126+ scope VARCHAR NOT NULL,
127+ PRIMARY KEY (id)
128+ ); ' ;
129+
121130 try {
122131 self ::$ pdo ->exec ( $ query );
123132 } catch ( PDOException $ exception ) {
@@ -187,6 +196,10 @@ private function common_retrieval_function() {
187196 * [ 'id', '<', 100 ],
188197 * [ 'name', 'ee' ]
189198 * ])
199+ * or where([
200+ * 'id' => 100,
201+ * 'name' => 'ee',
202+ * ])
190203 *
191204 * Supported operators are: '=', '<', '>', '<=', '>=', '==', '!=', '<>', 'like', 'in'
192205 *
@@ -201,8 +214,15 @@ public function where( ...$args ) {
201214 $ conditions = [];
202215
203216 if ( 'array ' === gettype ( $ args [0 ] ) ) {
204- foreach ( $ args [0 ] as $ condition ) {
205- $ conditions [] = $ this ->get_where_fragment ( $ condition );
217+ if ( \EE \Utils \is_assoc ( $ args [0 ] ) ) {
218+ $ condition_keys = array_keys ( $ args [0 ] );
219+ foreach ( $ condition_keys as $ key ) {
220+ $ conditions [] = $ this ->get_where_fragment ( [ $ key , $ args [0 ][ $ key ] ] );
221+ }
222+ } else {
223+ foreach ( $ args [0 ] as $ condition ) {
224+ $ conditions [] = $ this ->get_where_fragment ( $ condition );
225+ }
206226 }
207227 } else {
208228 $ conditions [] = $ this ->get_where_fragment ( $ args );
0 commit comments