diff --git a/src/Controller/Component/BcDbMigrator5Component.php b/src/Controller/Component/BcDbMigrator5Component.php index 2f9cf1c..6a22e39 100755 --- a/src/Controller/Component/BcDbMigrator5Component.php +++ b/src/Controller/Component/BcDbMigrator5Component.php @@ -252,6 +252,7 @@ protected function _updateContent() $records = $this->readCsv('contents'); $table = $this->tableLocator->get('BaserCore.Contents'); $table->removeBehavior('Tree'); + BcUtil::offEvent($table->getEventManager(), 'Model.beforeMarshal'); BcUtil::offEvent($table->getEventManager(), 'Model.afterSave'); foreach($records as $record) { $record['site_id'] = $this->getSiteId($record['site_id']); @@ -276,11 +277,7 @@ protected function _updateContent() try { $entity = $table->newEmptyEntity(); $entity->setAccess('id', true); - if(!$record['parent_id']) { - $entity = $table->patchEntity($entity, $record, ['validate' => false]); - } else { - $entity = $table->patchEntity($entity, $record, ['validate' => false]); - } + $entity = $table->patchEntity($entity, $record, ['validate' => false]); $table->saveOrFail($entity); } catch (PersistenceException $e) { $this->log('contents: ' . $e->getEntity()->getMessage(), LogLevel::ERROR, 'migrate_db');