load parent fields fix

This commit is contained in:
Yuri Kuznetsov
2024-05-02 10:10:12 +03:00
parent cc88ab9290
commit ffa5cf44ea
2 changed files with 3 additions and 10 deletions

View File

@@ -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;
}

View File

@@ -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');
}
/**