@@ 119-126 (lines=8) @@ | ||
116 | * |
|
117 | * @return int numero de registros actualizados |
|
118 | */ |
|
119 | public static function updateAll(array $fields, $where = null, array $values = []) |
|
120 | { |
|
121 | if ($values !== null && !is_array($values)) { |
|
122 | $values = \array_slice(\func_get_args(), 2); |
|
123 | } |
|
124 | $sql = QueryGenerator::updateAll(\get_called_class(), $fields, $values, $where); |
|
125 | $sth = self::prepare($sql); |
|
126 | $sth->execute($values); |
|
127 | ||
128 | return $sth->rowCount(); |
|
129 | } |
|
@@ 319-326 (lines=8) @@ | ||
316 | * |
|
317 | * @return int |
|
318 | */ |
|
319 | public static function count($where = null, $values = null) |
|
320 | { |
|
321 | $source = static::getSource(); |
|
322 | $sql = QueryGenerator::count($source, $where); |
|
323 | if ($values !== null && !is_array($values)) { |
|
324 | $values = \array_slice(\func_get_args(), 1); |
|
325 | } |
|
326 | $sth = static::query($sql, $values); |
|
327 | ||
328 | return $sth->fetch()->count; |
|
329 | } |