fix: [cli:importer] Support of accessibleFields for new entities

pull/72/head
Sami Mokaddem 2021-10-20 11:44:23 +02:00
parent 43dfacfe72
commit 4cb1a2f736
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
2 changed files with 17 additions and 2 deletions

View File

@ -128,7 +128,9 @@ class ImporterCommand extends Command
$this->loadModel('MetaFields');
$entities = [];
if (is_null($primary_key)) {
$entities = $table->newEntities($data);
$entities = $table->newEntities($data, [
'accessibleFields' => ($table->newEmptyEntity())->getAccessibleFieldForNew()
]);
} else {
foreach ($data as $i => $item) {
$entity = null;
@ -145,7 +147,9 @@ class ImporterCommand extends Command
$this->lockAccess($entity);
}
if (!is_null($entity)) {
$entity = $table->patchEntity($entity, $item);
$entity = $table->patchEntity($entity, $item, [
'accessibleFields' => $entity->getAccessibleFieldForNew()
]);
$entities[] = $entity;
}
}

View File

@ -0,0 +1,11 @@
{
"format": "json",
"mapping": {
"name": "{n}.Organisation.name",
"uuid": "{n}.Organisation.uuid",
"nationality": "{n}.Organisation.nationality"
},
"sourceHeaders": {
"Authorization": "~~YOUR_API_KEY_HERE~~"
}
}