Skip to content

Commit

Permalink
WebAPI プラグインの削除に失敗する問題の修正
Browse files Browse the repository at this point in the history
WebAPI プラグインを削除する際, 以下のようなエラーが発生するのを修正

> MappingException.php line 63:
> File mapping drivers must have a valid directory path, however the given path [/path/to/ec-cube/vendor/league/oauth2-server-bundle/src/Entity] seems to be incorrect!

MappingDriver が既に削除された Bundle のパスを参照してしまうが, 関連テーブルは既に削除されているため無視しても問題ないと思われる
  • Loading branch information
nanasess committed Jul 5, 2022
1 parent e5642d2 commit 9612e11
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/Eccube/Service/PluginService.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use Doctrine\Common\Collections\Criteria;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\Persistence\Mapping\MappingException;
use Eccube\Common\Constant;
use Eccube\Common\EccubeConfig;
use Eccube\Entity\Plugin;
Expand Down Expand Up @@ -593,9 +594,6 @@ public function uninstall(Plugin $plugin, $force = true)
}
$this->unregisterPlugin($plugin);

// スキーマを更新する
$this->generateProxyAndUpdateSchema($plugin, $config, true);

// プラグインのネームスペースに含まれるEntityのテーブルを削除する
$namespace = 'Plugin\\'.$plugin->getCode().'\\Entity';
$this->schemaService->dropTable($namespace);
Expand All @@ -605,6 +603,13 @@ public function uninstall(Plugin $plugin, $force = true)
$this->removeAssets($plugin->getCode());
}

// スキーマを更新する
try {
$this->generateProxyAndUpdateSchema($plugin, $config, true);
} catch (MappingException $e) {
// 削除された Bundle が MappingException をスローする場合があるが実害は無いので無視して進める
}

$this->pluginApiService->pluginUninstalled($plugin);

return true;
Expand Down

0 comments on commit 9612e11

Please sign in to comment.