public function where($expr = null, array $args = array())
{
if (!$this->where) {
$this->where = new Conditions();
}
if ($expr) {
if (is_string($expr)) {
$this->where->appendExpr($expr, $args);
} elseif (is_array($expr)) {
foreach ($expr as $key => $val) {
$this->where->equal($key, $val);
}
} else {
throw new InvalidArgumentException("Unsupported argument type of 'where' method.");
}
}
return $this->where;
}