- WIP on Ulmus -- new use case showed up, modification were needed.
This commit is contained in:
1 parent
1b051f923e
commit
b589ba3c2b
5 files changed
+28
-13
No files matched your search
@@ -20,6 +20,8 @@ class EntityResolver {
|
||||
public array $properties;
|
||||
|
||||
public array $methods;
|
||||
|
||||
protected array $fieldList = [];
|
||||
|
||||
public function __construct(string $entityClass)
|
||||
{
|
||||
@@ -28,18 +30,22 @@ class EntityResolver {
|
||||
list($this->uses, $this->class, $this->methods, $this->properties) = array_values(
|
||||
ObjectReflection::fromClass($entityClass)->read()
|
||||
);
|
||||
|
||||
|
||||
$this->resolveAnnotations();
|
||||
}
|
||||
|
||||
public function field($name, $fieldKey = self::KEY_ENTITY_NAME) : ? array
|
||||
public function field($name, $fieldKey = self::KEY_ENTITY_NAME, $throwException = true) : ? array
|
||||
{
|
||||
try{
|
||||
return $this->fieldList($fieldKey)[$name];
|
||||
}
|
||||
catch(\Throwable $e) {
|
||||
throw new \InvalidArgumentException("Can't find entity field's column named `$name` from entity {$this->entityClass}");
|
||||
if ( $throwException) {
|
||||
throw new \InvalidArgumentException("Can't find entity field's column named `$name` from entity {$this->entityClass}");
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function fieldList($fieldKey = self::KEY_ENTITY_NAME) : array
|
||||
|
||||
Reference in new issue
Block a user