Skip to content

Commit 8d6e62b

Browse files
committed
Check for null tertiary key
1 parent da2a89d commit 8d6e62b

2 files changed

Lines changed: 12 additions & 7 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Change Log
22

3+
## v4.1.14-alpha
4+
- Fix issue with scopes being applied twice in Unique::getPaginatedQuery (https://github.com/userfrosting/extend-user/issues/2)
5+
36
## v4.1.13-alpha
47
- `ufTable`: Implement `rowTemplate` for customizing how rows are rendered (#787)
58
- `ufTable`: Support for passing callbacks for column templates instead of Handlebars templates

app/sprinkles/core/src/Database/Relations/Concerns/Unique.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -437,13 +437,15 @@ protected function buildDictionary(Collection $results, $parentKey = null)
437437
if (!is_null($tertiaryModels)) {
438438
$tertiaryKeyValue = $result->pivot->{$this->tertiaryKey};
439439

440-
$tertiaryModel = clone $tertiaryModels[$tertiaryKeyValue];
441-
442-
// We also transfer the pivot relation at this point, since we have already coalesced
443-
// any tertiary models into the nested dictionary.
444-
$this->transferPivotsToTertiary($result, $tertiaryModel);
445-
446-
$nestedTertiaryDictionary[$parentKeyValue][$result->getKey()][] = $tertiaryModel;
440+
if (!is_null($tertiaryKeyValue)) {
441+
$tertiaryModel = clone $tertiaryModels[$tertiaryKeyValue];
442+
443+
// We also transfer the pivot relation at this point, since we have already coalesced
444+
// any tertiary models into the nested dictionary.
445+
$this->transferPivotsToTertiary($result, $tertiaryModel);
446+
447+
$nestedTertiaryDictionary[$parentKeyValue][$result->getKey()][] = $tertiaryModel;
448+
}
447449
}
448450
}
449451

0 commit comments

Comments
 (0)