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