This commit is contained in:
mcndave committed 2021-10-21 19:32:12 +00:00
commit e4767f7c09
11 files changed
+178 -55

No files matched your search

+8 -6
View File
@@ -115,18 +115,20 @@ class EntityResolver {
return null;
}
public function searchFieldAnnotation(string $field, Annotation $annotationType) : ? Annotation
public function searchFieldAnnotation(string $field, Annotation $annotationType, bool $caseSensitive = true) : ? Annotation
{
$found = $this->searchFieldAnnotationList($field, $annotationType);
$found = $this->searchFieldAnnotationList($field, $annotationType, $caseSensitive);
return $found ? $found[0] : null;
}
public function searchFieldAnnotationList(string $field, Annotation $annotationType) : array
public function searchFieldAnnotationList(string $field, Annotation $annotationType, bool $caseSensitive = true) : array
{
$list = [];
if ( null !== ( $this->properties[$field] ?? null ) ) {
foreach($this->properties[$field]['tags'] ?? [] as $tag) {
$search = $caseSensitive ? $this->properties : array_change_key_case($this->properties, \CASE_LOWER);
if ( null !== ( $search[$field] ?? null ) ) {
foreach($search[$field]['tags'] ?? [] as $tag) {
if ( $tag['object'] instanceof $annotationType ) {
$list[] = $tag['object'];
}