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