Skip to content

Commit

Permalink
Merge pull request #46 from ho-nl/tenkate
Browse files Browse the repository at this point in the history
PHP 8.1 and Magento v2.4.7-p3
  • Loading branch information
Maikel-Koek authored Oct 23, 2024
2 parents ea2396e + 976aad9 commit e51bb1f
Show file tree
Hide file tree
Showing 5 changed files with 140 additions and 201 deletions.
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
"name": "honl/magento2-import",
"description": "",
"require": {
"php": "~7.1.0 || ~7.2.0 || ~7.3.0 || ~7.4.0 || ~8.2",
"php": "~7.1.0 || ~7.2.0 || ~7.3.0 || ~7.4.0 || ~8.1 || ~8.2",
"guzzlehttp/guzzle": "^7",
"prewk/xml-string-streamer": "^1.2",
"prewk/xml-string-streamer-guzzle": "^1.2",
"kevinrob/guzzle-cache-middleware": "^4",
"ecomdev/magento-psr6-bridge": "^0.2.1",
"ho-nl-fork/magento-psr6-bridge": "dev-master",
"symfony/stopwatch": "^v6.2",
"bakame/psr7-csv-factory": "^1.0@dev",
"ho-nl-fork/psr7-csv-factory": "dev-master",
"league/csv": "^9.1",
"monolog/monolog": "^2.8",
"ext-mbstring": "*"
Expand Down
2 changes: 2 additions & 0 deletions src/Api/ImportProfileInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ interface ImportProfileInterface
*/
public function getItems();

public function getProcessedItems(): array;

/**
* Array of the config values
*
Expand Down
13 changes: 12 additions & 1 deletion src/Model/ImportProfile.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ abstract class ImportProfile implements ImportProfileInterface
*/
private $errors = null;

private ?array $processedItems = null;

/**
* @param ObjectManagerFactory $objectManagerFactory
* @param Stopwatch $stopwatch
Expand Down Expand Up @@ -89,7 +91,10 @@ public function run()
$errors = $importer->processImport($items);
$stopwatchEvent = $this->stopwatch->stop('importinstance');

$output = (string) new Phrase('%1 items imported in %2 sec, <info>%3 items / sec</info> (%4mb used)', [
$message = $errors
? 'Tried to import %1 items in %2 sec, <info>%3 items / sec</info> (%4mb used)'
: '%1 items imported in %2 sec, <info>%3 items / sec</info> (%4mb used)';
$output = (string) new Phrase($message, [
count($items),
round($stopwatchEvent->getDuration() / 1000, 1),
round(count($items) / ($stopwatchEvent->getDuration() / 1000), 1),
Expand All @@ -102,6 +107,7 @@ public function run()
$this->consoleOutput->writeln("<error>$errors</error>");
$this->log->error($errors);

$this->processedItems = $items;
$this->errors = $errors;

return \Magento\Framework\Console\Cli::RETURN_SUCCESS;
Expand Down Expand Up @@ -135,6 +141,11 @@ public function getErrors()
return $this->errors;
}

public function getProcessedItems(): array
{
return $this->processedItems;
}

/**
* Get all items that need to be imported
*
Expand Down
Loading

0 comments on commit e51bb1f

Please sign in to comment.