Skip to content

Commit cc5d0e0

Browse files
committed
refactoring
1 parent 12a21b9 commit cc5d0e0

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/Database/Table/Selection.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -319,19 +319,18 @@ public function wherePrimary($key)
319319
*/
320320
public function where($condition, ...$params)
321321
{
322+
$this->emptyResultSet();
322323
if (is_array($condition) && $params === []) { // where(array('column1' => 1, 'column2 > ?' => 2))
323324
foreach ($condition as $key => $val) {
324325
if (is_int($key)) {
325-
$this->where($val); // where('full condition')
326+
$this->sqlBuilder->addWhere($val); // where('full condition')
326327
} else {
327-
$this->where($key, $val); // where('column', 1)
328+
$this->sqlBuilder->addWhere($key, $val); // where('column', 1)
328329
}
329330
}
330-
return $this;
331+
} else {
332+
$this->sqlBuilder->addWhere($condition, ...$params);
331333
}
332-
333-
$this->emptyResultSet();
334-
$this->sqlBuilder->addWhere($condition, ...$params);
335334
return $this;
336335
}
337336

0 commit comments

Comments
 (0)