Skip to content

Commit 49cc33c

Browse files
committed
bugfix: missing var for navigation while exporting
1 parent 3a5c9dc commit 49cc33c

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

src/Exports/Exporters/BaseImportUsedDataExporter.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,10 @@ protected function buildExportingQueryForImportUsed($query, $type)
152152
'webSetting',
153153
'documentType',
154154
]);
155+
case ImportDataHelper::FOLDER_IDENTIFIER_NAVIGATION:
156+
return $query->with([
157+
'content.path',
158+
]);
155159
}
156160

157161
return $query;

src/ImportData/Entities/Navigation.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace SolutionForest\InspireCms\ImportData\Entities;
44

55
use Illuminate\Database\Eloquent\Model;
6+
use SolutionForest\InspireCms\Models\Contracts\Content;
67
use SolutionForest\InspireCms\Models\Contracts\Navigation as ContractsNavigation;
78

89
/**
@@ -121,6 +122,8 @@ public static function fromRecord($record)
121122
{
122123
$data = collect($record->toArray())->only(static::$limitedProperties)->except('children')->all();
123124

125+
$data['contentSlugPath'] = $record->content?->path?->value;
126+
124127
$children = [];
125128

126129
foreach ($record->children as $item) {

src/Services/ImportDataService.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,13 @@ protected function processForNavigation()
491491
$this->finished['navigation'][] = $navigation ?? null;
492492

493493
} catch (\Throwable $th) {
494-
$this->processErrors['navigation'][] = $th->getMessage();
494+
$errorMsg = 'Error while processing navigation item: ' . $item->title;
495+
if (filled($th->getMessage())) {
496+
$errorMsg .= ' - ' . $th->getMessage();
497+
} else {
498+
$errorMsg .= ' - ' . get_class($th);
499+
}
500+
$this->processErrors['navigation'][$category][] = $errorMsg;
495501
}
496502
}
497503

@@ -502,7 +508,13 @@ protected function processForNavigation()
502508
try {
503509
$model::scoped(['category' => $category])->rebuildTree($treeData, true);
504510
} catch (\Throwable $th) {
505-
$this->processErrors['navigation'][] = $th->getMessage();
511+
$errorMsg = 'Error while rebuilding tree for category: ' . $category;
512+
if (filled($th->getMessage())) {
513+
$errorMsg .= ' - ' . $th->getMessage();
514+
} else {
515+
$errorMsg .= ' - ' . get_class($th);
516+
}
517+
$this->processErrors['navigation'][$category][] = $errorMsg;
506518
}
507519
}
508520
}

0 commit comments

Comments
 (0)