Skip to content

Commit

Permalink
Make the setting csv_delimiter.
Browse files Browse the repository at this point in the history
  • Loading branch information
duncanmcclean committed Nov 7, 2024
1 parent eba4f02 commit 778cf1d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/Sources/Csv.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ class Csv extends AbstractSource
public function getItems(string $path): LazyCollection
{
return SimpleExcelReader::create($path)
->useDelimiter($this->config('delimiter', ','))
->useDelimiter($this->config('csv_delimiter', ','))
->getRows();
}

public function fieldItems(): array
{
return [
'delimiter' => [
'csv_delimiter' => [
'display' => __('CSV Delimiter'),
'instructions' => __('Specify the delimiter to be used when reading the CSV file. You will need to save the import for the options to be updated.'),
'type' => 'text',
Expand Down
4 changes: 2 additions & 2 deletions tests/Imports/UpdateImportTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function can_update_an_import()
'name' => 'Old Posts',
'destination' => ['type' => 'entries', 'collection' => ['posts']],
'strategy' => ['create', 'update'],
'source' => ['delimiter' => ','],
'source' => ['csv_delimiter' => ','],
'mappings' => [
'title' => ['key' => 'Title'],
'slug' => ['key' => 'Slug'],
Expand Down Expand Up @@ -96,7 +96,7 @@ public function can_replace_the_file()
'file' => ['123456789/latest-posts.csv'],
'destination' => ['type' => 'entries', 'collection' => ['posts']],
'strategy' => ['create', 'update'],
'source' => ['delimiter' => ','],
'source' => ['csv_delimiter' => ','],
'mappings' => [
'title' => ['key' => 'Title'],
'slug' => ['key' => 'Slug'],
Expand Down

0 comments on commit 778cf1d

Please sign in to comment.