Skip to content

Commit

Permalink
コンテンツデータ読み込みの際にエラーとなってしまう問題を改善
Browse files Browse the repository at this point in the history
  • Loading branch information
ryuring committed Nov 25, 2024
1 parent c69b007 commit 0c671f7
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/Controller/Component/BcDbMigrator5Component.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
Expand All @@ -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');
Expand Down

0 comments on commit 0c671f7

Please # to comment.