mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #1819 from oddnoc/csvbulkloader-findexisting-3.1
Use the correct variable as the key into $record
This commit is contained in:
commit
5d9cbae949
@ -166,7 +166,7 @@ class CsvBulkLoader extends BulkLoader {
|
||||
foreach($this->duplicateChecks as $fieldName => $duplicateCheck) {
|
||||
if(is_string($duplicateCheck)) {
|
||||
$SQL_fieldName = Convert::raw2sql($duplicateCheck);
|
||||
if(!isset($record[$fieldName]) || empty($record[$fieldName])) { //skip current duplicate check if field value is empty
|
||||
if(!isset($record[$SQL_fieldName]) || empty($record[$SQL_fieldName])) { //skip current duplicate check if field value is empty
|
||||
continue;
|
||||
}
|
||||
$SQL_fieldValue = Convert::raw2sql($record[$fieldName]);
|
||||
|
@ -152,9 +152,7 @@ class CsvBulkLoaderTest extends SapphireTest {
|
||||
$filepath = $this->getCurrentAbsolutePath() . '/CsvBulkLoaderTest_PlayersWithId.csv';
|
||||
$loader->duplicateChecks = array(
|
||||
'ExternalIdentifier' => 'ExternalIdentifier',
|
||||
'NonExistantIdentifier' => 'ExternalIdentifier',
|
||||
'ExternalIdentifier' => 'ExternalIdentifier',
|
||||
'AdditionalIdentifier' => 'ExternalIdentifier'
|
||||
);
|
||||
$results = $loader->load($filepath);
|
||||
$createdPlayers = $results->Created();
|
||||
|
Loading…
Reference in New Issue
Block a user