Skip to content

Commit

Permalink
Merge branch 'main' of github.com:cerebrate-project/cerebrate into main
Browse files Browse the repository at this point in the history
  • Loading branch information
iglocska committed Oct 21, 2021
2 parents 5a7f7df + 739dc25 commit e2d6022
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/Command/ImporterCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

/**
* Generic importer to feed data to cerebrate from JSON or CSV.
*
*
* - JSON configuration file must have the `format` key which can either take the value `json` or `csv`
* - If `csv` is provided, the file must contains the header.
* - If `json` is provided, a `mapping` key on how to reach each fields using the cakephp4's Hash syntax must be provided.
* - The mapping is done in the following way:
* - The key is the field name
* - The value
* - Can either be the string representing the path from which to get the value
* - Or a JSON containg the `path`, the optional `override` parameter specifying if the existing data should be overriden
* - Or a JSON containg the `path`, the optional `override` parameter specifying if the existing data should be overriden
* and an optional `massage` function able to alter the data.
* - Example
* {
Expand All @@ -22,7 +22,7 @@
* },
*
* - The optional primary key argument provides a way to make import replayable. It can typically be used when an ID or UUID is not provided in the source file but can be replaced by something else (e.g. team-name or other type of unique data).
*
*
*/

namespace App\Command;
Expand Down Expand Up @@ -165,7 +165,7 @@ private function marshalData($table, $data, $config, $primary_key=null)
'valueField' => 'id'
])->where(['meta_template_id' => $metaTemplate->id])->toArray();
} else {
$this->io->error("Unkown template for UUID {$config['metaTemplateUUID']}");
$this->io->error("Unknown template for UUID {$config['metaTemplateUUID']}");
die(1);
}
}
Expand Down Expand Up @@ -196,7 +196,7 @@ private function marshalData($table, $data, $config, $primary_key=null)
$metaEntity->meta_template_field_id = $metaTemplateFieldsMapping[$fieldName];
} else {
$hasErrors = true;
$this->io->error("Field $fieldName is unkown for template {$metaTemplate->name}");
$this->io->error("Field $fieldName is unknown for template {$metaTemplate->name}");
break;
}
}
Expand Down Expand Up @@ -529,4 +529,4 @@ private function nullToEmptyString($value)
{
return is_null($value) ? '' : $value;
}
}
}

0 comments on commit e2d6022

Please sign in to comment.