Skip to content

Commit

Permalink
Update Version20210112135542.php
Browse files Browse the repository at this point in the history
Try to fix script
  • Loading branch information
zkabic authored Apr 23, 2024
1 parent 961255e commit 11762ff
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function postUp(Schema $schema): void

foreach ($results as $result) {
$legacyExtra = $this->unserializeExtraField($result['extra']);
if (empty($legacyExtra)) {
if (!is_array($legacyExtra)) {
++$totalArticlesProcessed;
continue;
}
Expand All @@ -92,8 +92,8 @@ public function postUp(Schema $schema): void
Article::class,
$result['id']
);

foreach ($legacyExtra as $key => $extraItem) {
try {
foreach ($legacyExtra as $key => $extraItem) {
if (is_array($extraItem)) {
$extra = ArticleExtraEmbedField::newFromValue($key, $extraItem);
} else {
Expand All @@ -102,6 +102,9 @@ public function postUp(Schema $schema): void
$extra->setArticle($article);
$entityManager->persist($extra);
}
} catch (\Throwable $e) {
echo ">>>> E: " . $e->getMessage() . "\n";
}

++$totalArticlesProcessed;
if (0 == ($totalArticlesProcessed % $batchSize)) {
Expand Down

0 comments on commit 11762ff

Please sign in to comment.