- Some minors adjustments to match PHP 8.x coding styles
This commit is contained in:
1 parent
3736fbe0f6
commit
fed7d2e302
4 files changed
+23
-19
No files matched your search
@@ -47,7 +47,7 @@ class RelationBuilder
|
||||
}
|
||||
}
|
||||
|
||||
public function searchRelation(string $name) : object|bool
|
||||
public function searchRelation(string $name) : mixed
|
||||
{
|
||||
# Resolve relations here if one is called
|
||||
if ( $this->entity->isLoaded() ) {
|
||||
@@ -55,7 +55,13 @@ class RelationBuilder
|
||||
return $dataset;
|
||||
}
|
||||
|
||||
return $this->resolveRelation($name) ?: $this->resolveVirtual($name) ?: false;
|
||||
if ( false !== $value = $this->resolveRelation($name) ) {
|
||||
return $value;
|
||||
}
|
||||
elseif ( false !== $value = $this->resolveVirtual($name) ) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
if ( $relation = $this->resolver->searchFieldAnnotation($name, [ Attribute\Property\Relation::class , Relation::class ] ) ) {
|
||||
@@ -69,7 +75,7 @@ class RelationBuilder
|
||||
return false;
|
||||
}
|
||||
|
||||
protected function resolveVirtual(string $name) : bool|object
|
||||
protected function resolveVirtual(string $name) : mixed
|
||||
{
|
||||
if (null !== ($virtual = $this->resolver->searchFieldAnnotation($name, [ Attribute\Property\Virtual::class, Annotation\Property\Virtual::class ]))) {
|
||||
if ($virtual->closure ?? false) {
|
||||
@@ -82,7 +88,7 @@ class RelationBuilder
|
||||
return false;
|
||||
}
|
||||
|
||||
protected function resolveRelation(string $name) : bool|object
|
||||
protected function resolveRelation(string $name) : mixed
|
||||
{
|
||||
if ( null !== ( $relation = $this->resolver->searchFieldAnnotation($name, [ Attribute\Property\Relation::class, Relation::class ] ) ) ) {
|
||||
$this->orders = $this->resolver->searchFieldAnnotationList($name, [ Attribute\Property\OrderBy::class, OrderBy::class ] );
|
||||
@@ -109,14 +115,14 @@ class RelationBuilder
|
||||
|
||||
$this->entity->eventExecute(Event\EntityRelationLoadInterface::class, $name, $this->repository);
|
||||
|
||||
return call_user_func([ $this->repository, $relation->function() ]);
|
||||
return call_user_func([ $this->repository, $relation->function() ]);
|
||||
|
||||
case $relation->isManyToMany():
|
||||
$this->manyToMany($name, $relation, $relationRelation);
|
||||
|
||||
$this->entity->eventExecute(Event\EntityRelationLoadInterface::class, $name, $this->repository);
|
||||
|
||||
$results = call_user_func([ $this->repository, 'loadAll' ]);
|
||||
$results = call_user_func([ $this->repository, $relationRelation->function() ]);
|
||||
|
||||
if ($relation->bridgeField ?? false) {
|
||||
$collection = $relation->bridge::entityCollection();
|
||||
|
||||
Reference in new issue
Block a user