Helper function to update entities with uuid.
array $sandbox: A sandbox where conversion happens.
string $table: A table whose data should be updated.
string $primary_key: A $table primary key column.
array $values: A $primary_key values of rows to be updated.
function update_add_uuids(&$sandbox, $table, $primary_key, $values) {
$uuid = new Uuid();
foreach ($values as $value) {
db_update($table)
->fields(array(
'uuid' => $uuid
->generate(),
))
->condition($primary_key, $value)
->isNull('uuid')
->execute();
$sandbox['progress']++;
$sandbox['last'] = $value;
}
}