This commit is contained in:
Yuri Kuznetsov
2022-02-17 16:53:09 +02:00
parent 0f020bb3ba
commit e5a0774e3e
18 changed files with 249 additions and 92 deletions
+21 -2
View File
@@ -33,16 +33,31 @@ use RuntimeException;
class EntityDefs
{
private $data;
/**
* @var array<string,array<string,mixed>>
*/
private array $data;
private $name;
private string $name;
/**
* @var array<string,?AttributeDefs>
*/
private $attributeCache = [];
/**
* @var array<string,?RelationDefs>
*/
private $relationCache = [];
/**
* @var array<string,?IndexDefs>
*/
private $indexCache = [];
/**
* @var array<string,?FieldDefs>
*/
private $fieldCache = [];
private function __construct()
@@ -224,6 +239,7 @@ class EntityDefs
throw new RuntimeException("Attribute '{$name}' does not exist.");
}
/** @var AttributeDefs */
return $this->attributeCache[$name];
}
@@ -239,6 +255,7 @@ class EntityDefs
throw new RuntimeException("Relation '{$name}' does not exist.");
}
/** @var RelationDefs */
return $this->relationCache[$name];
}
@@ -254,6 +271,7 @@ class EntityDefs
throw new RuntimeException("Index '{$name}' does not exist.");
}
/** @var IndexDefs */
return $this->indexCache[$name];
}
@@ -269,6 +287,7 @@ class EntityDefs
throw new RuntimeException("Field '{$name}' does not exist.");
}
/** @var FieldDefs */
return $this->fieldCache[$name];
}