- Added a closure on key to EntityCollection buildArray method.

- Some bugfixes done.
This commit is contained in:
mcndave committed 2021-03-29 20:01:31 +00:00
1 parent 317d62ceaa
commit 1469d167c4
3 files changed
+13 -9

No files matched your search

+5 -3
View File
@@ -238,7 +238,7 @@ class EntityResolver {
/**
* Transform an annotation into it's object's counterpart
*/
public function getAnnotationFromClassname(string $className) : ? object
public function getAnnotationFromClassname(string $className, bool $throwError = true) : ? object
{
if ( $name = $this->uses[$className] ?? false ) {
@@ -264,9 +264,11 @@ class EntityResolver {
}
}
throw new \TypeError("Annotation `$className` could not be found within your object `{$this->entityClass}`");
if ($throwError) {
throw new \TypeError("Annotation `$className` could not be found within your object `{$this->entityClass}`");
}
}
else {
elseif ($throwError) {
throw new \InvalidArgumentException("Class `$className` was not found within {$this->entityClass} uses statement (or it's children / traits)");
}