Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
public function migrate(Chunk $chunk, Shard $dstShard, array $schemas)
{
$shardId = $chunk->getShardId();
if ($dstShard->id === $shardId) {
throw new InvalidArgumentException("{$dstShard->id} == $shardId");
}
try {
$created = $this->clone($chunk, $dstShard, $schemas);
$missed = $this->verify($chunk, $dstShard, $schemas);
$deleted = $this->remove($chunk, $schemas);
return new MigrateResult(true, [
'created' => $created,
'missed' => $missed,
'deleted' => $deleted,
]);
} catch (MigrateException $e) {
$deleted = $this->removeFrom($chunk, $dstShard, $schemas);
return new MigrateResult(false, [
'deleted' => $deleted,
]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.