EspoCRM – Open Source CRM Application
PHP calendarcontactscrmcrm-platformcrm-systemcustomer-portalcustomer-supportcustomizabledocumentsemail-marketingkanbanleadsopen-sourcephpplatformsales-automationsingle-page-applicationsupport
Entity manager tool remove more metadata, link removal earlier
Yuriiaa53cd4e21de
diff --git a/application/Espo/Tools/EntityManager/EntityManager.php b/application/Espo/Tools/EntityManager/EntityManager.phpindex 7c1c3ce6b4..a3b6479849 100644--- a/application/Espo/Tools/EntityManager/EntityManager.php+++ b/application/Espo/Tools/EntityManager/EntityManager.php@@ -546,6 +546,12 @@ class EntityManagerthrow new Error("Type '$type' is not removable.");}+ foreach ($this->metadata->get(['entityDefs', $name, 'links'], []) as $link => $item) {+ try {+ $this->linkManager->delete(['entity' => $name, 'link' => $link]);+ } catch (Exception) {}+ }+$entityTypeParams = new Params($name, $type, $this->getCurrentParams($name));$this->metadata->delete('entityDefs', $name);@@ -556,12 +562,6 @@ class EntityManager$this->metadata->delete('aclDefs', $name);$this->metadata->delete('scopes', $name);- foreach ($this->metadata->get(['entityDefs', $name, 'links'], []) as $link => $item) {- try {- $this->linkManager->delete(['entity' => $name, 'link' => $link]);- } catch (Exception) {}- }-$this->removeFiles($name);try {@@ -861,12 +861,21 @@ class EntityManager$normalizedName = Util::normalizeClassName($name);- $this->fileManager->removeFile("custom/Espo/Custom/Resources/metadata/entityDefs/$name.json");- $this->fileManager->removeFile("custom/Espo/Custom/Resources/metadata/clientDefs/$name.json");- $this->fileManager->removeFile("custom/Espo/Custom/Resources/metadata/recordDefs/$name.json");- $this->fileManager->removeFile("custom/Espo/Custom/Resources/metadata/selectDefs/$name.json");- $this->fileManager->removeFile("custom/Espo/Custom/Resources/metadata/logicDefs/$name.json");- $this->fileManager->removeFile("custom/Espo/Custom/Resources/metadata/scopes/$name.json");+ $dirs = [+ 'aclDefs',+ 'clientDefs',+ 'entityAcl',+ 'entityDefs',+ 'formula',+ 'logicDefs',+ 'recordDefs',+ 'scopes',+ 'selectDefs',+ ];++ foreach ($dirs as $dir) {+ $this->fileManager->removeFile("custom/Espo/Custom/Resources/metadata/$dir/$name.json");+ }$this->fileManager->removeFile("custom/Espo/Custom/Entities/$normalizedName.php");$this->fileManager->removeFile("custom/Espo/Custom/Services/$normalizedName.php");