Skip to content

Commit

Permalink
Merge pull request #12 from City-of-Helsinki/HELFI-X-translatable-mig…
Browse files Browse the repository at this point in the history
…rate-destination

Use http source plugin provided by helfi_api_base to support request …
  • Loading branch information
tuutti authored Feb 12, 2021
2 parents 82bbff8 + 7e17b74 commit c1b1a76
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 20 deletions.
23 changes: 4 additions & 19 deletions src/Plugin/migrate/source/ServiceMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,16 @@
class ServiceMap extends HttpSourcePluginBase implements ContainerFactoryPluginInterface {

/**
* Keep track of ignored rows to stop migrate after N ignored rows.
* The total count.
*
* @var int
*/
protected int $ignoredRows = 0;
protected int $count = 0;

/**
* The total count.
*
* @var int
* {@inheritdoc}
*/
protected int $count = 0;
protected bool $useRequestCache = FALSE;

/**
* {@inheritdoc}
Expand Down Expand Up @@ -62,19 +60,6 @@ public function fields() {
return [];
}

/**
* {@inheritdoc}
*/
public function next() {
parent::next();

// Check if the current row has changes and increment ignoredRows variable
// to allow us to stop migrate early if we have no changes.
if ($this->isPartialMigrate() && $this->currentRow && !$this->currentRow->changed()) {
$this->ignoredRows++;
}
}

/**
* {@inheritdoc}
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Plugin/migrate/source/ServiceRegister.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ protected function initializeListIterator() : \Iterator {
$url = $this->buildCanonicalUrl(sprintf('%s?language=%s', $item['id'], $language));
$data = $this->getContent($url);

list('id' => $id) = $data;
['id' => $id] = $data;

if (!isset($service[$id])) {
$service[$id] = [];
Expand Down

0 comments on commit c1b1a76

Please sign in to comment.