Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.x] Rename qualifyColumn to qualifyPivotColumn in BelongsToMany & MorphToMany #35276

Merged
merged 1 commit into from Nov 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php
Expand Up @@ -362,7 +362,7 @@ public function wherePivot($column, $operator = null, $value = null, $boolean =
{
$this->pivotWheres[] = func_get_args();

return $this->where($this->qualifyColumn($column), $operator, $value, $boolean);
return $this->where($this->qualifyPivotColumn($column), $operator, $value, $boolean);
}

/**
Expand All @@ -376,7 +376,7 @@ public function wherePivot($column, $operator = null, $value = null, $boolean =
*/
public function wherePivotBetween($column, array $values, $boolean = 'and', $not = false)
{
return $this->whereBetween($this->qualifyColumn($column), $values, $boolean, $not);
return $this->whereBetween($this->qualifyPivotColumn($column), $values, $boolean, $not);
}

/**
Expand Down Expand Up @@ -429,7 +429,7 @@ public function wherePivotIn($column, $values, $boolean = 'and', $not = false)
{
$this->pivotWhereIns[] = func_get_args();

return $this->whereIn($this->qualifyColumn($column), $values, $boolean, $not);
return $this->whereIn($this->qualifyPivotColumn($column), $values, $boolean, $not);
}

/**
Expand Down Expand Up @@ -524,7 +524,7 @@ public function wherePivotNull($column, $boolean = 'and', $not = false)
{
$this->pivotWhereNulls[] = func_get_args();

return $this->whereNull($this->qualifyColumn($column), $boolean, $not);
return $this->whereNull($this->qualifyPivotColumn($column), $boolean, $not);
}

/**
Expand Down Expand Up @@ -810,7 +810,7 @@ protected function aliasedPivotColumns()
$defaults = [$this->foreignPivotKey, $this->relatedPivotKey];

return collect(array_merge($defaults, $this->pivotColumns))->map(function ($column) {
return $this->qualifyColumn($column).' as pivot_'.$column;
return $this->qualifyPivotColumn($column).' as pivot_'.$column;
})->unique()->all();
}

Expand Down Expand Up @@ -1230,7 +1230,7 @@ public function getForeignPivotKeyName()
*/
public function getQualifiedForeignPivotKeyName()
{
return $this->qualifyColumn($this->foreignPivotKey);
return $this->qualifyPivotColumn($this->foreignPivotKey);
}

/**
Expand All @@ -1250,7 +1250,7 @@ public function getRelatedPivotKeyName()
*/
public function getQualifiedRelatedPivotKeyName()
{
return $this->qualifyColumn($this->relatedPivotKey);
return $this->qualifyPivotColumn($this->relatedPivotKey);
}

/**
Expand Down Expand Up @@ -1339,7 +1339,7 @@ public function getPivotColumns()
* @param string $column
* @return string
*/
public function qualifyColumn($column)
public function qualifyPivotColumn($column)
{
return Str::contains($column, '.')
? $column
Expand Down
8 changes: 4 additions & 4 deletions src/Illuminate/Database/Eloquent/Relations/MorphToMany.php
Expand Up @@ -68,7 +68,7 @@ protected function addWhereConstraints()
{
parent::addWhereConstraints();

$this->query->where($this->qualifyColumn($this->morphType), $this->morphClass);
$this->query->where($this->qualifyPivotColumn($this->morphType), $this->morphClass);

return $this;
}
Expand All @@ -83,7 +83,7 @@ public function addEagerConstraints(array $models)
{
parent::addEagerConstraints($models);

$this->query->where($this->qualifyColumn($this->morphType), $this->morphClass);
$this->query->where($this->qualifyPivotColumn($this->morphType), $this->morphClass);
}

/**
Expand Down Expand Up @@ -111,7 +111,7 @@ protected function baseAttachRecord($id, $timed)
public function getRelationExistenceQuery(Builder $query, Builder $parentQuery, $columns = ['*'])
{
return parent::getRelationExistenceQuery($query, $parentQuery, $columns)->where(
$this->qualifyColumn($this->morphType), $this->morphClass
$this->qualifyPivotColumn($this->morphType), $this->morphClass
);
}

Expand Down Expand Up @@ -173,7 +173,7 @@ protected function aliasedPivotColumns()
$defaults = [$this->foreignPivotKey, $this->relatedPivotKey, $this->morphType];

return collect(array_merge($defaults, $this->pivotColumns))->map(function ($column) {
return $this->qualifyColumn($column).' as pivot_'.$column;
return $this->qualifyPivotColumn($column).' as pivot_'.$column;
})->unique()->all();
}

Expand Down