public static function update(array $data, array $where)
{
if (!sizeof($where)) {
throw new DbException("Method `Table::update()` can't update all records in table,\n" . "please use `Db::query()` instead (of cause if you know what are you doing)");
}
$self = static::getInstance();
$data = $self->filterColumns($data);
$where = $self->filterColumns($where);
if (!sizeof($data) || !sizeof($where)) {
throw new DbException("Invalid field names of table `{$self->table}`. Please check use of `update()` method");
}
$table = DbProxy::quoteIdentifier($self->table);
$sql = "UPDATE {$table}" . " SET " . join(',', self::prepareStatement($data)) . " WHERE " . join(' AND ', self::prepareStatement($where));
return DbProxy::query($sql, array_merge(array_values($data), array_values($where)));
}