Skip to content

Commit

Permalink
Fix updateExport() extension hook
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco Hermo committed Sep 16, 2018
1 parent 2c87959 commit 472caab
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions _config/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
Name: swiftypesearch
After: 'framework/*','cms/*','searchlist/*'
---
LeftAndMain:
extensions:
Expand Down
8 changes: 7 additions & 1 deletion src/Processor/SwiftExporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public function export($dataObject, $clientClassName = null)

$record = $dataObject->toMap();
$fields = Config::databaseFields($dataClassName);
$this->extend('updateExport', $record, $clientClassName);

$document = [
'external_id' => $record['ID'],
Expand All @@ -53,6 +54,12 @@ public function export($dataObject, $clientClassName = null)
$value,
$fields[$column]
);
} else {
$document['fields'][] = [
'type' => 'enum',
'name' => $column,
'value' => $value
];
}
}

Expand Down Expand Up @@ -124,7 +131,6 @@ public function export($dataObject, $clientClassName = null)
}
}

$this->extend('updateExport', $document, $clientClassName);
$dataObject->destroy();

return $document;
Expand Down

0 comments on commit 472caab

Please sign in to comment.