- 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

+7 -7
View File
@@ -199,20 +199,20 @@ class RelationBuilder
protected function fetchFromDataset($name, ? array $data = null) : object|bool
{
$annotation = $this->resolver->searchFieldAnnotation($name, [ Join::class ]) ?:
$attribute = $this->resolver->searchFieldAnnotation($name, [ Join::class ]) ?:
$this->resolver->searchFieldAnnotation($name, [ Relation::class ]);
if ( $annotation ) {
if ( $attribute ) {
$vars = [];
$len = strlen( $name ) + 1;
$isRelation = $annotation instanceof Relation;
$isRelation = $attribute instanceof Relation;
if ( $isRelation && $annotation->isManyToMany() ) {
$entity = $this->relationAnnotations($name, $annotation)['relationRelation']->entity;
if ( $isRelation && $attribute->isManyToMany() ) {
$entity = $this->relationAnnotations($name, $attribute)['relationRelation']->entity;
}
else {
$entity = $annotation->entity ?? $this->resolver->reflectedClass->getProperties()[$name]->getTypes()[0]->type;
$entity = $attribute->entity ?? $this->resolver->reflectedClass->getProperties()[$name]->getTypes()[0]->type;
}
$name = strtolower($name);
@@ -323,7 +323,7 @@ class RelationBuilder
$relationRelation = $bridgeEntity->searchFieldAnnotation($relation->foreignField, [ Relation::class ]);
if ($relationRelation === null) {
throw new \Exception("@Relation annotation not found for field `{$relation->foreignField}` in entity {$relation->bridge}");
throw new \Exception("@Relation attribute not found for field `{$relation->foreignField}` in entity {$relation->bridge}");
}
$relationRelation->entity ??= $relation->bridge::resolveEntity()->reflectedClass->getProperties()[$relation->foreignField]->getTypes()[0]->type;