Skip to content

Commit c3931e5

Browse files
author
Gregory Haddow
committed
fix: custom relationship meta not returned on PaginatedRelatedResourceResponse or PaginatedIdentifierResponse
1 parent f673e0e commit c3931e5

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

Diff for: src/Core/Responses/Concerns/HasRelationship.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ private function allMeta(): ?Hash
4848
*
4949
* @return array|null
5050
*/
51-
private function metaForRelationship(): ?array
51+
protected function metaForRelationship(): ?array
5252
{
5353
if ($this->hasRelationMeta && $relation = $this->relation()) {
5454
return $relation->meta();

Diff for: src/Core/Responses/Internal/PaginatedIdentifierResponse.php

+2
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ public function __construct(JsonApiResource $resource, string $fieldName, Page $
4343
public function meta(): Hash
4444
{
4545
return Hash::cast($this->page->meta())->merge(
46+
Hash::cast(parent::metaForRelationship())
47+
)->merge(
4648
parent::meta()
4749
);
4850
}

Diff for: src/Core/Responses/Internal/PaginatedRelatedResourceResponse.php

+2
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ public function __construct(JsonApiResource $resource, string $fieldName, Page $
4343
public function meta(): Hash
4444
{
4545
return Hash::cast($this->page->meta())->merge(
46+
Hash::cast(parent::metaForRelationship())
47+
)->merge(
4648
parent::meta()
4749
);
4850
}

0 commit comments

Comments
 (0)