Skip to content

Commit d090b4c

Browse files
authored
Adapt to rename Query::$join (#475)
* Adapt to rename `Query::$join` * fix
1 parent 7d7faa1 commit d090b4c

2 files changed

Lines changed: 15 additions & 15 deletions

File tree

src/ActiveQuery.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ public function populate(array $rows): array
242242
return [];
243243
}
244244

245-
if (!empty($this->join) && $this->indexBy === null) {
245+
if (!empty($this->joins) && $this->indexBy === null) {
246246
$rows = $this->removeDuplicatedRows($rows);
247247
}
248248

@@ -415,9 +415,9 @@ public function resetJoinWith(): void
415415
*/
416416
public function buildJoinWith(): void
417417
{
418-
$join = $this->join;
418+
$joins = $this->joins;
419419

420-
$this->join = [];
420+
$this->joins = [];
421421

422422
$model = $this->getModel();
423423

@@ -447,30 +447,30 @@ public function buildJoinWith(): void
447447
*/
448448
$uniqueJoins = [];
449449

450-
foreach ($this->join as $j) {
451-
$uniqueJoins[serialize($j)] = $j;
450+
foreach ($this->joins as $join) {
451+
$uniqueJoins[serialize($join)] = $join;
452452
}
453-
$this->join = array_values($uniqueJoins);
453+
$this->joins = array_values($uniqueJoins);
454454

455455
/**
456456
* @link https://github.com/yiisoft/yii2/issues/16092
457457
*/
458458
$uniqueJoinsByTableName = [];
459459

460-
foreach ($this->join as $config) {
461-
$tableName = serialize($config[1]);
460+
foreach ($this->joins as $join) {
461+
$tableName = serialize($join[1]);
462462
if (!array_key_exists($tableName, $uniqueJoinsByTableName)) {
463-
$uniqueJoinsByTableName[$tableName] = $config;
463+
$uniqueJoinsByTableName[$tableName] = $join;
464464
}
465465
}
466466

467-
$this->join = array_values($uniqueJoinsByTableName);
467+
$this->joins = array_values($uniqueJoinsByTableName);
468468

469-
if (!empty($join)) {
469+
if (!empty($joins)) {
470470
/**
471471
* Append explicit join to {@see joinWith()} {@link https://github.com/yiisoft/yii2/issues/2880}
472472
*/
473-
$this->join = empty($this->join) ? $join : array_merge($this->join, $join);
473+
$this->joins = empty($this->joins) ? $joins : array_merge($this->joins, $joins);
474474
}
475475
}
476476

@@ -683,7 +683,7 @@ private function joinWithRelation(ActiveQueryInterface $parent, ActiveQueryInter
683683

684684
if (!empty($child->getJoins())) {
685685
foreach ($child->getJoins() as $join) {
686-
$this->join[] = $join;
686+
$this->joins[] = $join;
687687
}
688688
}
689689

@@ -869,7 +869,7 @@ private function createInstance(): static
869869
->distinct($this->distinct)
870870
->from($this->from)
871871
->groupBy($this->groupBy)
872-
->setJoins($this->join)
872+
->setJoins($this->joins)
873873
->having($this->having)
874874
->setUnions($this->union)
875875
->params($this->params)

src/ActiveRelationTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ private function indexBuckets(array $buckets, Closure|string $indexBy): array
493493
*/
494494
private function prefixKeyColumns(array $columnNames): array
495495
{
496-
if (!empty($this->join) || !empty($this->joinWith)) {
496+
if (!empty($this->joins) || !empty($this->joinWith)) {
497497
if (empty($this->from)) {
498498
$alias = $this->getModel()->tableName();
499499
} else {

0 commit comments

Comments
 (0)