Skip to content

Commit

Permalink
Fix bad query during Relationship Live Preview
Browse files Browse the repository at this point in the history
  • Loading branch information
bryannielsen committed Oct 17, 2024
1 parent 7610837 commit 94af65f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## [Unreleased]

### Fixed

- Incorrect column name used in a Relationship fieldtype query during a Live Preview request

## [1.4.2] - 2024-09-26

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion src/Fieldtypes/Presenters/Traits/QueriesRelationships.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function buildRelationshipQuery(FieldContent $content, Model $model, $tab
$tableName = $tableName ?: Str::singular($model->getTable()).'_relationships';

if ($content->entry->isPreview()) {
$query->whereIn('member_id', $content->data['data'] ?? [0]);
$query->whereIn($model->getKeyName(), $content->data['data'] ?? [0]);
} else {
$query->select("{$model->getTable()}.*")
->join($tableName, $model->getKeyName(), '=', 'child_id')
Expand Down

0 comments on commit 94af65f

Please sign in to comment.