Skip to content

Commit e5fdedb

Browse files
authored
Fix exporting when using UUIDs (#524)
1 parent 712568d commit e5fdedb

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/Commands/ExportEntries.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,21 +73,21 @@ private function exportEntries()
7373
return ! $model->origin_id;
7474
});
7575

76-
if ($entriesWithOrigin->count() > 0) {
76+
if ($entriesWithoutOrigin->count() > 0) {
7777
$this->info('Exporting origin entries');
7878
}
7979

8080
$this->withProgressBar($entriesWithoutOrigin, function ($model) {
8181
$entry = Entry::make()
82+
->collection($model->collection)
8283
->locale($model->site)
8384
->slug($model->slug)
84-
->collection($model->collection)
8585
->data($model->data)
8686
->blueprint($model->blueprint)
8787
->template($model->data['template'] ?? null)
8888
->published($model->published);
8989

90-
if (in_array(HasUuids::class, class_uses_recursive($model))) {
90+
if ($model->getKeyType() == 'string' || in_array(HasUuids::class, class_uses_recursive($model))) {
9191
$entry->id($model->getKey());
9292
}
9393

@@ -107,16 +107,21 @@ private function exportEntries()
107107
$this->info('Exporting localized entries');
108108

109109
$this->withProgressBar($entriesWithOrigin, function ($model) {
110+
110111
$entry = Entry::make()
112+
->collection($model->collection)
111113
->origin($model->origin_id)
112114
->locale($model->site)
113115
->slug($model->slug)
114-
->collection($model->collection)
115116
->data($model->data)
116117
->blueprint($model->data['blueprint'] ?? null)
117118
->template($model->data['template'] ?? null)
118119
->published($model->published);
119120

121+
if ($model->getKeyType() == 'string' || in_array(HasUuids::class, class_uses_recursive($model))) {
122+
$entry->id($model->getKey());
123+
}
124+
120125
if ($model->date && $entry->collection()->dated()) {
121126
$entry->date($model->date);
122127
}

0 commit comments

Comments
 (0)