| @@ 108-115 (lines=8) @@ | ||
| 105 | * |
|
| 106 | * @return int numero de registros actualizados |
|
| 107 | */ |
|
| 108 | public static function updateAll(array $fields, $where = null, array $values = []) |
|
| 109 | { |
|
| 110 | if ($values !== null && !is_array($values)) { |
|
| 111 | $values = \array_slice(\func_get_args(), 2); |
|
| 112 | } |
|
| 113 | $sql = QueryGenerator::updateAll(\get_called_class(), $fields, $values, $where); |
|
| 114 | $sth = self::prepare($sql); |
|
| 115 | $sth->execute($values); |
|
| 116 | ||
| 117 | return $sth->rowCount(); |
|
| 118 | } |
|
| @@ 308-315 (lines=8) @@ | ||
| 305 | * |
|
| 306 | * @return int |
|
| 307 | */ |
|
| 308 | public static function count($where = null, $values = null) |
|
| 309 | { |
|
| 310 | $source = static::getSource(); |
|
| 311 | $sql = QueryGenerator::count($source, $where); |
|
| 312 | if ($values !== null && !is_array($values)) { |
|
| 313 | $values = \array_slice(\func_get_args(), 1); |
|
| 314 | } |
|
| 315 | $sth = static::query($sql, $values); |
|
| 316 | ||
| 317 | return $sth->fetch()->count; |
|
| 318 | } |
|