Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Commit

Permalink
Merge a661aaf into 099c080
Browse files Browse the repository at this point in the history
  • Loading branch information
Jalle19 committed Feb 21, 2018
2 parents 099c080 + a661aaf commit a6641bc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/Console/Commands/AbstractSyncCommand.php
Expand Up @@ -86,10 +86,10 @@ public function __construct(
*/
public function handle()
{
// Parse options and set defaults
$this->ignoreExisting = (bool)$this->option('ignoreExisting');
$this->numSynchronized = 0;
$this->skip = 0;
// Parse options and reset counters
$this->ignoreExisting = (bool)$this->option('ignoreExisting');

$this->resetCounters();
}

/**
Expand All @@ -99,4 +99,13 @@ protected function getClient(): Client
{
return $this->contentfulService->getClient();
}

/**
* Resets the "skip" and "numSynchronized" counters
*/
protected function resetCounters(): void
{
$this->numSynchronized = 0;
$this->skip = 0;
}
}
3 changes: 3 additions & 0 deletions src/Console/Commands/SyncContentsCommand.php
Expand Up @@ -69,6 +69,9 @@ public function handle()
$contentTypes = $contentType !== null ? [$contentType] : $this->contentTypes;

foreach ($contentTypes as $contentType) {
// Reset counters before each content type
$this->resetCounters();

$this->synchronizeContentType($contentType);
}
}
Expand Down

0 comments on commit a6641bc

Please sign in to comment.