From abd5dab6053e8958ec31eb15b37cafbc2096f2ab Mon Sep 17 00:00:00 2001 From: Sami Mokaddem Date: Fri, 31 Mar 2023 13:55:48 +0200 Subject: [PATCH] chg: [command:importer] Make sure to use the latest known version of the template --- src/Command/ImporterCommand.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Command/ImporterCommand.php b/src/Command/ImporterCommand.php index 3aba536..dee4e24 100644 --- a/src/Command/ImporterCommand.php +++ b/src/Command/ImporterCommand.php @@ -158,6 +158,7 @@ class ImporterCommand extends Command if (!$this->noMetaTemplate) { $metaTemplate = $this->MetaTemplates->find() ->where(['uuid' => $config['metaTemplateUUID']]) + ->order(['version' => 'DESC']) ->first(); if (!is_null($metaTemplate)) { $metaTemplateFieldsMapping = $this->MetaTemplates->MetaTemplateFields->find('list', [ @@ -192,6 +193,7 @@ class ImporterCommand extends Command $metaEntity->field = $fieldName; $metaEntity->scope = $table->getBehavior('MetaFields')->getScope(); $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 $metaEntity->meta_template_field_id = $metaTemplateFieldsMapping[$fieldName]; } else {