- Multiple bug fixes related to notes 2.x

This commit is contained in:
Dave Mc Nicoll committed 2024-05-31 12:26:39 +00:00
1 parent f3be11a590
commit bd9078230d
9 files changed
+69 -73

No files matched your search

+6 -12
View File
@@ -12,6 +12,8 @@ use Ulmus\Ulmus,
Ulmus\Attribute\Property\Relation,
Ulmus\Attribute\Property\Virtual;
use Notes\Common\ReflectedAttribute;
use Notes\ObjectReflection;
class EntityResolver {
@@ -118,7 +120,7 @@ class EntityResolver {
return $this->searchFieldAnnotationList($field, $annotationType, $caseSensitive)[0] ?? null;
}
public function searchFieldAnnotationList(string $field, array|object|string $annotationType, bool $caseSensitive = true) : array
public function searchFieldAnnotationList(string $field, array|object|string $attributeType, bool $caseSensitive = true) : false|array
{
$list = [];
@@ -126,19 +128,11 @@ class EntityResolver {
$search = $caseSensitive ? $properties : array_change_key_case($properties, \CASE_LOWER);
$annotations = is_array($annotationType) ? $annotationType : [ $annotationType ];
if ( null !== ( $search[$field] ?? null ) ) {
foreach($search[$field]->getAttributes() as $tag) {
foreach($annotations as $annotation) {
if ( $tag->object instanceof $annotation ) {
$list[] = $tag->object;
}
}
}
return array_map(fn(ReflectedAttribute $e) => $e->object, $search[$field]->getAttributes((array) $attributeType));
}
return $list;
return false;
}
public function tableName($required = false) : string