diff --git a/application/Espo/Tools/EntityManager/EntityManager.php b/application/Espo/Tools/EntityManager/EntityManager.php index 29157595fc..3b0c877a1a 100644 --- a/application/Espo/Tools/EntityManager/EntityManager.php +++ b/application/Espo/Tools/EntityManager/EntityManager.php @@ -778,21 +778,35 @@ class EntityManager $this->processHook('afterRemove', $type, $name); } - $tabList = $this->config->get('tabList', []); - - if (($key = array_search($name, $tabList)) !== false) { - unset($tabList[$key]); - - $tabList = array_values($tabList); - } - - $this->configWriter->set('tabList', $tabList); - - $this->configWriter->save(); + $this->deleteEntityTypeFromConfigParams($name); $this->dataManager->clearCache(); } + private function deleteEntityTypeFromConfigParams(string $entityType): void + { + $paramList = $this->metadata->get(['app', 'config', 'entityTypeListParamList']) ?? []; + + foreach ($paramList as $param) { + $this->deleteEntityTypeFromConfigParam($entityType, $param); + } + + $this->configWriter->save(); + } + + private function deleteEntityTypeFromConfigParam(string $entityType, string $param): void + { + $list = $this->config->get($param) ?? []; + + if (($key = array_search($entityType, $list)) !== false) { + unset($list[$key]); + + $list = array_values($list); + } + + $this->configWriter->set($param, $list); + } + protected function isCustom(string $name): bool { return (bool) $this->metadata->get('scopes.' . $name . '.isCustom');