src/Koldy/Db/Model.php
public static function increment(string $field, $where, int $howMuch = 1): int
    {
        $update = new Update(static::getTableName(), null, static::getAdapterConnection());
        $update->increment($field, $howMuch);

        if ($where instanceof Where) {
            $update->where($where);
        } else if (is_array($where)) {
            foreach ($where as $field => $value) {
                $update->where($field, $value);
            }
        } else if (!is_array(static::$primaryKey) && (is_numeric($where) || is_string($where))) {
            $update->where(static::$primaryKey, $where);
        } else {
            throw new Exception('Unhandled increment case in DB model');
        }

        return $update->exec()->rowCount();
    }
public static function increment(string $field, $where, int $howMuch = 1): int
    {
        $update = new Update(static::getTableName(), null, static::getAdapterConnection());
        $update->increment($field, $howMuch);

        if ($where instanceof Where) {
            $update->where($where);
        } else if (is_array($where)) {
            foreach ($where as $field => $value) {
                $update->where($field, $value);
            }
        } else if (!is_array(static::$primaryKey) && (is_numeric($where) || is_string($where))) {
            $update->where(static::$primaryKey, $where);
        } else {
            throw new Exception('Unhandled increment case in DB model');
        }

        return $update->exec()->rowCount();
    }
public static function increment ( string $ field , $ where , int $ howMuch = 1 ) : int { $ update = new Update ( static :: getTableName ( ) , null , static :: getAdapterConnection ( ) ) ; $ update -> increment ( $ field , $ howMuch ) ; if ( $ where instanceof Where ) { $ update -> where ( $ where ) ; } else if ( is_array ( $ where ) ) { foreach ( $ where as $ field => $ value ) { $ update -> where ( $ field , $ value ) ; } } else if ( ! is_array ( static :: $ primaryKey ) && ( is_numeric ( $ where ) || is_string ( $ where ) ) ) { $ update -> where ( static :: $ primaryKey , $ where ) ; } else { throw new Exception ( 'Unhandled increment case in DB model' ) ; } return $ update -> exec ( ) -> rowCount ( ) ; }
Increment one numeric field in table on the row identified by primary key.
You can use this only if your primary key is just one field.

@param string $field
@param mixed $where the primary key value of the record
@param int $howMuch default 1

@return int number of affected rows
@throws Exception
@throws Query\Exception
@throws \Koldy\Exception
Increment one numeric field in table on the row identified by primary key . You can use this only if your primary key is just one field .