Skip to content

Commit

Permalink
fix: custom relationship meta not returned on PaginatedRelatedResourc…
Browse files Browse the repository at this point in the history
…eResponse or PaginatedIdentifierResponse
  • Loading branch information
Gregory Haddow committed Dec 19, 2024
1 parent f673e0e commit c3931e5
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 c3931e5

Please sign in to comment.