| @@ 131-138 (lines=8) @@ | ||
| 128 | * |
|
| 129 | * @return int numero de registros actualizados |
|
| 130 | */ |
|
| 131 | public static function updateAll(array $fields, $where = null, array $values = []) |
|
| 132 | { |
|
| 133 | if ($values !== null && !is_array($values)) { |
|
| 134 | $values = \array_slice(\func_get_args(), 2); |
|
| 135 | } |
|
| 136 | $sql = QueryGenerator::updateAll(\get_called_class(), $fields, $values, $where); |
|
| 137 | $sth = self::prepare($sql); |
|
| 138 | $sth->execute($values); |
|
| 139 | ||
| 140 | return $sth->rowCount(); |
|
| 141 | } |
|
| @@ 328-335 (lines=8) @@ | ||
| 325 | * |
|
| 326 | * @return int |
|
| 327 | */ |
|
| 328 | public static function count($where = null, $values = null) |
|
| 329 | { |
|
| 330 | $source = static::getSource(); |
|
| 331 | $sql = QueryGenerator::count($source, $where); |
|
| 332 | if ($values !== null && !is_array($values)) { |
|
| 333 | $values = \array_slice(\func_get_args(), 1); |
|
| 334 | } |
|
| 335 | $sth = static::query($sql, $values); |
|
| 336 | ||
| 337 | return $sth->fetch()->count; |
|
| 338 | } |
|