chg: [command:importer] Make sure to use the latest known version of the template
parent
5cb65f8fc1
commit
abd5dab605
|
@ -158,6 +158,7 @@ class ImporterCommand extends Command
|
||||||
if (!$this->noMetaTemplate) {
|
if (!$this->noMetaTemplate) {
|
||||||
$metaTemplate = $this->MetaTemplates->find()
|
$metaTemplate = $this->MetaTemplates->find()
|
||||||
->where(['uuid' => $config['metaTemplateUUID']])
|
->where(['uuid' => $config['metaTemplateUUID']])
|
||||||
|
->order(['version' => 'DESC'])
|
||||||
->first();
|
->first();
|
||||||
if (!is_null($metaTemplate)) {
|
if (!is_null($metaTemplate)) {
|
||||||
$metaTemplateFieldsMapping = $this->MetaTemplates->MetaTemplateFields->find('list', [
|
$metaTemplateFieldsMapping = $this->MetaTemplates->MetaTemplateFields->find('list', [
|
||||||
|
@ -192,6 +193,7 @@ class ImporterCommand extends Command
|
||||||
$metaEntity->field = $fieldName;
|
$metaEntity->field = $fieldName;
|
||||||
$metaEntity->scope = $table->getBehavior('MetaFields')->getScope();
|
$metaEntity->scope = $table->getBehavior('MetaFields')->getScope();
|
||||||
$metaEntity->meta_template_id = $metaTemplate->id;
|
$metaEntity->meta_template_id = $metaTemplate->id;
|
||||||
|
$metaEntity->meta_template_directory_id = $metaTemplate->meta_template_directory_id;
|
||||||
if (isset($metaTemplateFieldsMapping[$fieldName])) { // a meta field template must exists
|
if (isset($metaTemplateFieldsMapping[$fieldName])) { // a meta field template must exists
|
||||||
$metaEntity->meta_template_field_id = $metaTemplateFieldsMapping[$fieldName];
|
$metaEntity->meta_template_field_id = $metaTemplateFieldsMapping[$fieldName];
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue