From ffa5cf44eae0437b3d6ee26504d543ad8a80a537 Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Thu, 2 May 2024 10:10:12 +0300 Subject: [PATCH] load parent fields fix --- .../Espo/Core/FieldProcessing/LinkParent/Loader.php | 6 ------ application/Espo/Core/ORM/Entity.php | 7 +++---- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/application/Espo/Core/FieldProcessing/LinkParent/Loader.php b/application/Espo/Core/FieldProcessing/LinkParent/Loader.php index fb6d7eae68..4f6026f6ed 100644 --- a/application/Espo/Core/FieldProcessing/LinkParent/Loader.php +++ b/application/Espo/Core/FieldProcessing/LinkParent/Loader.php @@ -79,12 +79,6 @@ class Loader implements LoaderInterface $name = $fieldDefs->getName(); - if (!$entityDefs->hasRelation($fieldDefs->getName())) { - // Otherwise, loadParentNameField produces an error. - // @todo Revise. - continue; - } - $list[] = $name; } diff --git a/application/Espo/Core/ORM/Entity.php b/application/Espo/Core/ORM/Entity.php index 95f1a38847..37ff788220 100644 --- a/application/Espo/Core/ORM/Entity.php +++ b/application/Espo/Core/ORM/Entity.php @@ -31,6 +31,7 @@ namespace Espo\Core\ORM; use Espo\ORM\BaseEntity; use Espo\ORM\Query\Part\Order; +use Espo\ORM\Type\AttributeType; use Espo\ORM\Type\RelationType; use LogicException; @@ -64,10 +65,8 @@ class Entity extends BaseEntity */ public function hasLinkParentField(string $field): bool { - return - $this->getAttributeType($field . 'Type') == 'foreignType' && - $this->hasAttribute($field . 'Id') && - $this->hasRelation($field); + return $this->getAttributeType($field . 'Type') === AttributeType::FOREIGN_TYPE && + $this->hasAttribute($field . 'Id'); } /**