deferred load

This commit is contained in:
Yuri Kuznetsov
2024-11-14 18:39:27 +02:00
parent 432a0f0474
commit 95a8dc2742
2 changed files with 24 additions and 1 deletions

View File

@@ -30,7 +30,6 @@
namespace Espo\ORM\Relation;
use Espo\ORM\BaseEntity;
use Espo\ORM\Defs\RelationDefs;
use Espo\ORM\Entity;
use Espo\ORM\EntityCollection;
use Espo\ORM\EntityManager;
@@ -310,6 +309,10 @@ class RDBRelations implements Relations
->getEntity($this->entity->getEntityType())
->getRelation($relation);
if (!$defs->getParam('deferredLoad')) {
return null;
}
$relationType = $defs->getType();
$id = null;

View File

@@ -1330,6 +1330,26 @@
}
}
}
},
{
"if": {
"properties": {
"type": {
"anyOf": [
{"const": "belongsTo"},
{"const": "belongsToParent"}
]
}
}
},
"then": {
"properties": {
"deferredLoad": {
"type": "boolean",
"description": "When getting a related entity from an entity, it will be returned without loaded values. Values will be loaded on accessing. The downside is that it can return an entity even if it's deleted."
}
}
}
}
]
},