Skip to content

Commit

Permalink
fix: custom relationship meta not returned on paginated responses (#23)
Browse files Browse the repository at this point in the history
Co-authored-by: Gregory Haddow <[email protected]>
  • Loading branch information
haddowg and Gregory Haddow authored Jan 11, 2025
1 parent f673e0e commit 902408a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Core/Responses/Concerns/HasRelationship.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ private function allMeta(): ?Hash
*
* @return array|null
*/
private function metaForRelationship(): ?array
protected function metaForRelationship(): ?array
{
if ($this->hasRelationMeta && $relation = $this->relation()) {
return $relation->meta();
Expand Down
2 changes: 2 additions & 0 deletions src/Core/Responses/Internal/PaginatedIdentifierResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ public function __construct(JsonApiResource $resource, string $fieldName, Page $
public function meta(): Hash
{
return Hash::cast($this->page->meta())->merge(
Hash::cast(parent::metaForRelationship())
)->merge(
parent::meta()
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ public function __construct(JsonApiResource $resource, string $fieldName, Page $
public function meta(): Hash
{
return Hash::cast($this->page->meta())->merge(
Hash::cast(parent::metaForRelationship())
)->merge(
parent::meta()
);
}
Expand Down

0 comments on commit 902408a

Please sign in to comment.