Skip to content

[3.8] Fix getRelationQuery breaking changes #2263

New issue

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

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

Already on GitHub? # to your account

Merged
merged 4 commits into from
May 27, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 0 additions & 38 deletions src/Relations/HasMany.php
Original file line number Diff line number Diff line change
@@ -17,15 +17,6 @@ public function getForeignKeyName()
return $this->foreignKey;
}

/**
* Get the plain foreign key.
* @return string
*/
public function getPlainForeignKey()
{
return $this->getForeignKeyName();
}

/**
* Get the key for comparing against the parent key in "has" query.
* @return string
@@ -45,35 +36,6 @@ public function getRelationExistenceQuery(Builder $query, Builder $parentQuery,
return $query->select($foreignKey)->where($foreignKey, 'exists', true);
}

/**
* Add the constraints for a relationship count query.
* @param Builder $query
* @param Builder $parent
* @return Builder
*/
public function getRelationCountQuery(Builder $query, Builder $parent)
{
$foreignKey = $this->getHasCompareKey();

return $query->select($foreignKey)->where($foreignKey, 'exists', true);
}

/**
* Add the constraints for a relationship query.
* @param Builder $query
* @param Builder $parent
* @param array|mixed $columns
* @return Builder
*/
public function getRelationQuery(Builder $query, Builder $parent, $columns = ['*'])
{
$query->select($columns);

$key = $this->wrap($this->getQualifiedParentKeyName());

return $query->where($this->getHasCompareKey(), 'exists', true);
}

/**
* Get the name of the "where in" method for eager loading.
* @param \Illuminate\Database\Eloquent\Model $model
38 changes: 0 additions & 38 deletions src/Relations/HasOne.php
Original file line number Diff line number Diff line change
@@ -26,15 +26,6 @@ public function getHasCompareKey()
return $this->getForeignKeyName();
}

/**
* Get the plain foreign key.
* @return string
*/
public function getPlainForeignKey()
{
return $this->getForeignKeyName();
}

/**
* @inheritdoc
*/
@@ -45,35 +36,6 @@ public function getRelationExistenceQuery(Builder $query, Builder $parentQuery,
return $query->select($foreignKey)->where($foreignKey, 'exists', true);
}

/**
* Add the constraints for a relationship count query.
* @param Builder $query
* @param Builder $parent
* @return Builder
*/
public function getRelationCountQuery(Builder $query, Builder $parent)
{
$foreignKey = $this->getForeignKeyName();

return $query->select($foreignKey)->where($foreignKey, 'exists', true);
}

/**
* Add the constraints for a relationship query.
* @param Builder $query
* @param Builder $parent
* @param array|mixed $columns
* @return Builder
*/
public function getRelationQuery(Builder $query, Builder $parent, $columns = ['*'])
{
$query->select($columns);

$key = $this->wrap($this->getQualifiedParentKeyName());

return $query->where($this->getForeignKeyName(), 'exists', true);
}

/**
* Get the name of the "where in" method for eager loading.
* @param \Illuminate\Database\Eloquent\Model $model
1 change: 1 addition & 0 deletions tests/QueueTest.php
Original file line number Diff line number Diff line change
@@ -39,6 +39,7 @@ public function testQueueJobLifeCycle(): void
'job' => 'test',
'maxTries' => null,
'maxExceptions' => null,
'failOnTimeout' => false,
'backoff' => null,
'timeout' => null,
'data' => ['action' => 'QueueJobLifeCycle'],