Skip to content

Commit 6df9423

Browse files
author
Simon Karlen
committed
fixed query builder join
1 parent cc3617c commit 6df9423

File tree

5 files changed

+10
-4
lines changed

5 files changed

+10
-4
lines changed

src/ActiveRecord.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function attributes(): array
5555
* {@inheritdoc}
5656
* @throws InvalidConfigException
5757
*/
58-
public static function primaryKey()
58+
public static function primaryKey(): array
5959
{
6060
throw new InvalidConfigException('The primaryKey() method of RestClient ActiveRecord has to be implemented by child classes.');
6161
}

src/QueryBuilder.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,14 @@ public function buildJoin($joins, &$params): string
128128
}
129129

130130
$expand = [];
131-
foreach ($joins as $join) {
131+
foreach ($joins as $i => $join) {
132132
if (empty($join)) {
133133
continue;
134134
}
135+
if (is_array($join)) {
136+
$expand[] = $join[1];
137+
continue;
138+
}
135139
$expand[] = $join;
136140
}
137141

tests/RelationTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
namespace yiiunit\extensions\rest;
99

10-
1110
use Yii;
1211
use yiiunit\extensions\rest\fixtures\RestModelFixture;
1312
use yiiunit\extensions\rest\models\RestModel;

tests/models/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
ReservationEvent.php
2+
ReservationObject.php
3+
ReservationProperty.php
4+
ReservationShow.php

tests/models/RestModel.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
namespace yiiunit\extensions\rest\models;
99

10-
1110
use simialbi\yii2\rest\ActiveRecord;
1211

1312
/**

0 commit comments

Comments
 (0)