Skip to content

Commit

Permalink
Merge 4612531 into 543fe13
Browse files Browse the repository at this point in the history
  • Loading branch information
escapevisual committed Jan 30, 2020
2 parents 543fe13 + 4612531 commit 1727fc8
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions Classes/Service/Manager.php
@@ -1,4 +1,5 @@
<?php

namespace HDNET\Importr\Service;

use HDNET\Importr\Domain\Model\Import;
Expand Down Expand Up @@ -85,9 +86,7 @@ public function getPreview(Strategy $strategy, $filepath)
$data = [];
$resources = $this->initializeResources($strategy, $filepath);
foreach ($resources as $resource) {
/**
* @var \HDNET\Importr\Service\Resources\ResourceInterface $resource
*/
/** @var \HDNET\Importr\Service\Resources\ResourceInterface $resource */
// Resourcen Object anhand der Datei auswählen
if (preg_match($resource->getFilepathExpression(), $filepath)) {
// Resource "benutzen"
Expand Down Expand Up @@ -124,6 +123,8 @@ protected function runImport(Import $import)
}
}

$this->teardownTargets($import);

$this->emitSignal('postImport', $import);
}

Expand Down Expand Up @@ -176,6 +177,21 @@ protected function initializeTargets(Import $import)
return $targets;
}

/**
* @param \HDNET\Importr\Domain\Model\Import $import
*/
protected function teardownTargets(Import $import)
{
$targetConfiguration = $import->getStrategy()
->getTargets();
foreach ($targetConfiguration as $target => $configuration) {
$object = $this->objectManager->get($target);
$object->setConfiguration($configuration);
$object->getConfiguration();
$object->end($import->getStrategy());
}
}

/**
* @param int $interval
*/
Expand Down

0 comments on commit 1727fc8

Please sign in to comment.