Skip to content

EspoCRM – Open Source CRM Application

fix record tree entity removal when no real subject used

Yuri Kuznetsovbd13d45207b6
diff --git a/application/Espo/Services/RecordTree.php b/application/Espo/Services/RecordTree.php
index cd74b1c63f..5ce2b89b26 100644
--- a/application/Espo/Services/RecordTree.php
+++ b/application/Espo/Services/RecordTree.php
@@ -175,6 +175,11 @@ class RecordTree extends Record
{
$entityType = $this->getSubjectEntityType();
+ // If used without an actual subject entity.
+ if (!$this->entityManager->hasRepository($entityType)) {
+ return true;
+ }
+
$query = $this->selectBuilderFactory
->create()
->from($entityType)