@@ 103-110 (lines=8) @@ | ||
100 | * |
|
101 | * @return int numero de registros actualizados |
|
102 | */ |
|
103 | public static function updateAll(array $fields, $where = null, array $values = []) |
|
104 | { |
|
105 | if ($values !== null && !is_array($values)) { |
|
106 | $values = \array_slice(\func_get_args(), 2); |
|
107 | } |
|
108 | $sql = QueryGenerator::updateAll(\get_called_class(), $fields, $values, $where); |
|
109 | $sth = self::prepare($sql); |
|
110 | $sth->execute($values); |
|
111 | ||
112 | return $sth->rowCount(); |
|
113 | } |
|
@@ 303-310 (lines=8) @@ | ||
300 | * |
|
301 | * @return int |
|
302 | */ |
|
303 | public static function count($where = null, $values = null) |
|
304 | { |
|
305 | $source = static::getSource(); |
|
306 | $sql = QueryGenerator::count($source, $where); |
|
307 | if ($values !== null && !is_array($values)) { |
|
308 | $values = \array_slice(\func_get_args(), 1); |
|
309 | } |
|
310 | $sth = static::query($sql, $values); |
|
311 | ||
312 | return $sth->fetch()->count; |
|
313 | } |