| @@ 96-103 (lines=8) @@ | ||
| 93 | * |
|
| 94 | * @return int numero de registros actualizados |
|
| 95 | */ |
|
| 96 | public static function updateAll(array $fields, $where = null, array $values = []) |
|
| 97 | { |
|
| 98 | if ($values !== null && !is_array($values)) { |
|
| 99 | $values = \array_slice(\func_get_args(), 2); |
|
| 100 | } |
|
| 101 | $sql = QueryGenerator::updateAll(\get_called_class(), $fields, $values, $where); |
|
| 102 | $sth = self::prepare($sql); |
|
| 103 | $sth->execute($values); |
|
| 104 | ||
| 105 | return $sth->rowCount(); |
|
| 106 | } |
|
| @@ 296-303 (lines=8) @@ | ||
| 293 | * |
|
| 294 | * @return int |
|
| 295 | */ |
|
| 296 | public static function count($where = null, $values = null) |
|
| 297 | { |
|
| 298 | $source = static::getSource(); |
|
| 299 | $sql = QueryGenerator::count($source, $where); |
|
| 300 | if ($values !== null && !is_array($values)) { |
|
| 301 | $values = \array_slice(\func_get_args(), 1); |
|
| 302 | } |
|
| 303 | $sth = static::query($sql, $values); |
|
| 304 | ||
| 305 | return $sth->fetch()->count; |
|
| 306 | } |
|