Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

DuplicateChecks in CsvBulkLoader isn't working


Go to End


3 Posts   1026 Views

Avatar
quanto

Community Member, 91 Posts

3 April 2015 at 1:25am

Hi all

I have a question about duplicateChecks in CsvBulkLoader

class UitslagCsvBulkLoader extends CsvBulkLoader {
   public $delimiter =';';
   public $columnMap = array(
      
      'Paardnaam' => 'Paard.Naam',
      'Afstand'=>'Afstand',
      'Positie'=>'Positie',
      'Pikeurnaam'=>'Pikeur.Naam',
      'Pikeur2'=>'Pikeur2',
      'Wedstrijd'=>'Wedstrijd.Datum'/*,
      'Kortebaan'=>'Kortebaan.Naam'*/
   );
   public $duplicateChecks = array(
      'Pikeurnaam' => array('callback'=>'getPikeurNaam')/*, 
      'Pikeur' => 'Pikeur',
      'Wedstrijd'=> 'Wedstrijd'*/ 
   );
   ...
}


class Pikeur extends DataObject{
  private static $db = array(
    'Naam'=>'Varchar(255)',
    'Beschrijving'=>'HTMLText'
  );
  
  private static $has_many = array(
    'Uitslagen'=>'Uitslag',
  );
  
  private static $many_many = array(
    'Paarden'=>'Paard'
  );
  
  private static $summary_fields = array(
    'Naam'
  );
}

De error is "undefined index 'Pikeurnaam'"

2 rules of the csv:

Paardnaam;Pikeurnaam;Pikeur2;Afstand;Positie;Wedstrijd;Kortebaan
Edo Venus;M.A. Pools;J.T.S. Dekker;295;1e omloop;2015-04-01;Amsterdam

Anyone a clue? thanks in advance!

Avatar
quanto

Community Member, 91 Posts

8 April 2015 at 7:21am

Bump! This question is really important to me as my client wants the project live this week.

Avatar
swaiba

Forum Moderator, 1899 Posts

9 April 2015 at 2:57am

You must have left IRC... I suggested this module to you https://github.com/burnbright/silverstripe-importexport as it might have improved on core in an agreeable way for you.