EspoCRM – Open Source CRM Application
PHP calendarcontactscrmcrm-platformcrm-systemcustomer-portalcustomer-supportcustomizabledocumentsemail-marketingkanbanleadsopen-sourcephpplatformsales-automationsingle-page-applicationsupport
throw not found, not error
Yuri Kuznetsov67df53dda8bc
diff --git a/application/Espo/Core/Record/Service.php b/application/Espo/Core/Record/Service.phpindex f3d261ab5c..ec6c734016 100644--- a/application/Espo/Core/Record/Service.php+++ b/application/Espo/Core/Record/Service.php@@ -952,11 +952,17 @@ class Service implements Crud,throw new ForbiddenSilent("No read access.");}+ $entityDefs = $this->entityManager+ ->getDefs()+ ->getEntity($this->entityType);++ if (!$entityDefs->hasRelation($link)) {+ throw new NotFound("Link does not exist.");+ }+$this->processForbiddenLinkReadCheck($link);- $foreignEntityType = $this->entityManager- ->getDefs()- ->getEntity($this->entityType)+ $foreignEntityType = $entityDefs->getRelation($link)->getForeignEntityType();@@ -1062,7 +1068,7 @@ class Service implements Crud,$foreignEntityType = $entity->getRelationParam($link, RelationParam::ENTITY);if (!$foreignEntityType) {- throw new LogicException("Entity '$this->entityType' has not relation '$link'.");+ throw new NotFound("Entity $this->entityType does not have link $link.");}$foreignEntity = $this->entityManager->getEntityById($foreignEntityType, $foreignId);@@ -1116,7 +1122,7 @@ class Service implements Crud,$foreignEntityType = $entity->getRelationParam($link, RelationParam::ENTITY);if (!$foreignEntityType) {- throw new LogicException("Entity '$this->entityType' has not relation '$link'.");+ throw new NotFound("Entity $this->entityType does not have link $link.");}$foreignEntity = $this->entityManager->getEntityById($foreignEntityType, $foreignId);