From 9fc021c7eda1a1d28a045040b9d5ea25498f4286 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Thu, 21 Jan 2021 10:57:15 +0100 Subject: [PATCH] fix(migration): adapt to review --- src/Appwrite/Migration/Migration.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Appwrite/Migration/Migration.php b/src/Appwrite/Migration/Migration.php index a74c40cd81..a2b9a016ca 100644 --- a/src/Appwrite/Migration/Migration.php +++ b/src/Appwrite/Migration/Migration.php @@ -45,6 +45,8 @@ abstract class Migration * * @param Document $project * @param Database $projectDB + * + * @return Migration */ public function setProject(Document $project, Database $projectDB): Migration { @@ -59,12 +61,13 @@ abstract class Migration * * @param callable $callback */ - public function forEachDocument(callable $callback) + public function forEachDocument(callable $callback): void { - $sum = 30; + + $sum = $this->limit; $offset = 0; - while ($sum >= 30) { + while ($sum >= $this->limit) { $all = $this->projectDB->getCollection([ 'limit' => $this->limit, 'offset' => $offset, @@ -86,7 +89,6 @@ abstract class Migration try { $new = $this->projectDB->overwriteDocument($document->getArrayCopy()); } catch (\Throwable $th) { - var_dump($document); Console::error('Failed to update document: ' . $th->getMessage()); continue; }