- Multiple bug fixes related to notes 2.x
This commit is contained in:
1 parent
f3be11a590
commit
bd9078230d
9 files changed
+69
-73
No files matched your search
@@ -2,12 +2,10 @@
|
||||
|
||||
namespace Ulmus\Common;
|
||||
|
||||
use Ulmus\Annotation\Annotation;
|
||||
use Ulmus\Attribute;
|
||||
use Ulmus\Attribute\Property\{ Field };
|
||||
use Ulmus\Migration\FieldDefinition;
|
||||
use Ulmus\Ulmus,
|
||||
Ulmus\Adapter\AdapterInterface,
|
||||
Ulmus\Annotation\Property\Field,
|
||||
Ulmus\Query\WhereRawParameter;
|
||||
|
||||
class EntityField implements WhereRawParameter
|
||||
@@ -30,7 +28,7 @@ class EntityField implements WhereRawParameter
|
||||
|
||||
public function name($useAlias = true) : string
|
||||
{
|
||||
$name = $this->entityResolver->searchFieldAnnotation($this->name, [ Attribute\Property\Field::class, Field::class ] )->name ?? $this->name;
|
||||
$name = $this->entityResolver->searchFieldAnnotation($this->name, [ Field::class ] )->name ?? $this->name;
|
||||
|
||||
$name = $this->entityResolver->databaseAdapter()->adapter()->escapeIdentifier($name, AdapterInterface::IDENTIFIER_FIELD);
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in new issue
Block a user