@@ 137-147 (lines=11) @@ | ||
134 | * |
|
135 | * @return int numero de registros actualizados |
|
136 | */ |
|
137 | public static function updateAll(array $fields, $where = null, array $values = []) |
|
138 | { |
|
139 | if ($values !== null && !is_array($values)) { |
|
140 | $values = \array_slice(\func_get_args(), 2); |
|
141 | } |
|
142 | $sql = QueryGenerator::updateAll(\get_called_class(), $fields, $values, $where); |
|
143 | $sth = self::prepare($sql); |
|
144 | $sth->execute($values); |
|
145 | ||
146 | return $sth->rowCount(); |
|
147 | } |
|
148 | ||
149 | /** |
|
150 | * Eliminar registro. |
|
@@ 334-344 (lines=11) @@ | ||
331 | * |
|
332 | * @return int |
|
333 | */ |
|
334 | public static function count($where = null, $values = null) |
|
335 | { |
|
336 | $source = static::getSource(); |
|
337 | $sql = QueryGenerator::count($source, $where); |
|
338 | if ($values !== null && !is_array($values)) { |
|
339 | $values = \array_slice(\func_get_args(), 1); |
|
340 | } |
|
341 | $sth = static::query($sql, $values); |
|
342 | ||
343 | return $sth->fetch()->count; |
|
344 | } |
|
345 | ||
346 | /** |
|
347 | * Paginar. |