Skip to content

Commit 0f31aa0

Browse files
committed
fix relationship object
1 parent 6888e81 commit 0f31aa0

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/Serializer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ protected function serializeModel($model)
111111
$relationship = ['id' => $items->getId(), 'type' => $items->getType()];
112112
}
113113
if (!empty($relationship)) {
114-
$data['relationships'][$name] = $relationship;
114+
$data['relationships'][$name]['data'] = $relationship;
115115
}
116116
}
117117
}

tests/SerializerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public function testExpand()
8787
'field2' => 2,
8888
],
8989
'relationships' => [
90-
'extraField1' => ['id' => '123', 'type' => 'resource-models']
90+
'extraField1' => ['data' => ['id' => '123', 'type' => 'resource-models']]
9191
]
9292
];
9393
$model = new ResourceModel();

0 commit comments

Comments
 (0)