/**
  * Add a mapping between the local record and the external record
  *
  * @param Omeka_Record_RecordAbstract $record
  */
 protected function addOmekaApiImportRecordIdMap()
 {
     $recordType = get_class($this->record);
     $id = $this->externalId();
     $map = new OmekaApiImportRecordIdMap();
     $map->record_type = $recordType;
     $map->local_id = $this->record->id;
     $map->external_id = $id;
     $map->endpoint_uri = $this->endpointUri;
     $map->save();
 }
Esempio n. 2
0
 protected function importFiles($item)
 {
     $ingester = Omeka_File_Ingest_AbstractIngest::factory('Url', $item, array());
     $files = $this->files();
     //have to step through one by one so we can save the id map for each $fileRecord and $fileData
     foreach ($files as $fileData) {
         try {
             $fileRecords = $ingester->ingest(array($fileData));
         } catch (Exception $e) {
             _log($e);
             continue;
         }
         $item->saveFiles();
         $fileRecord = array_pop($fileRecords);
         $map = new OmekaApiImportRecordIdMap();
         $map->record_type = 'File';
         $map->local_id = $fileRecord->id;
         $map->external_id = $fileData['externalId'];
         $map->endpoint_uri = $this->endpointUri;
         $map->save();
     }
 }