Skip to content

Commit 2134ddf

Browse files
committed
Refactor and add docs
1 parent 5b1ec54 commit 2134ddf

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

src/lib/AttributeResolver.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class AttributeResolver
3838
public array $relations = [];
3939

4040
/**
41-
* @var AttributeRelation[]|array
41+
* @var array keys contains class names and value contains array of belongs to relations
4242
*/
4343
public array $belongsToRelations = [];
4444

src/lib/SchemaToDatabase.php

+2-4
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,8 @@ public function prepareModels(): array
113113
// handle belongs to relation
114114
foreach ($resolvers as $aResolver) {
115115
foreach ($aResolver->belongsToRelations as $name => $relations) {
116-
foreach ($relations as $relation) {
117-
/** @var AttributeRelation $relation */
118-
$models[$name]->belongsToRelations[] = $relation;
119-
}
116+
/** @var AttributeRelation[] $relations */
117+
$models[$name]->belongsToRelations = [...$models[$name]->belongsToRelations, ...$relations];
120118
}
121119
}
122120

src/lib/items/DbModel.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class DbModel extends BaseObject
8686
public bool $descriptionIsComment = false;
8787

8888
/**
89-
* @var array|AttributeRelation[] belongs to relations
89+
* @var AttributeRelation[] belongs to relations
9090
*/
9191
public array $belongsToRelations = [];
9292

0 commit comments

Comments
 (0)