function where($condition, $params = array())
{
$clone = clone $this;
// conditions in key-value array
if (is_array($condition)) {
foreach ($condition as $c => $params) {
$clone = $clone->where($c, $params);
}
return $clone;
}
// shortcut for basic "column is (in) value"
if (preg_match('/^[a-z0-9_.`"]+$/i', $condition)) {
$clone->where[] = $clone->db->is($condition, $params);
return $clone;
}
if (!is_array($params)) {
$params = func_get_args();
array_shift($params);
}
$clone->where[] = $condition;
$clone->whereParams = array_merge($clone->whereParams, $params);
return $clone;
}