orm defs: no type exception

This commit is contained in:
Yuri Kuznetsov
2021-12-02 12:54:17 +02:00
parent 6ee224ffbc
commit 83ced0d58f
2 changed files with 16 additions and 2 deletions
+9 -1
View File
@@ -29,6 +29,8 @@
namespace Espo\ORM\Defs;
use RuntimeException;
/**
* Field definitions.
*/
@@ -66,7 +68,13 @@ class FieldDefs
*/
public function getType(): string
{
return $this->data['type'];
$type = $this->data['type'] ?? null;
if ($type === null) {
throw new RuntimeException("Field '{$this->name}' has no type.");
}
return $type;
}
/**
+7 -1
View File
@@ -70,7 +70,13 @@ class RelationDefs
*/
public function getType(): string
{
return $this->data['type'];
$type = $this->data['type'] ?? null;
if ($type === null) {
throw new RuntimeException("Relation '{$this->name}' has no type.");
}
return $type;
}
/**