mirror of
https://github.com/espocrm/espocrm.git
synced 2026-06-28 06:56:05 +00:00
deferred load
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user