@@ -148,7 +148,7 @@ public function convertDataResourceToArray(ResourceObjectInterface $resource, $i
148
148
{
149
149
return $ this ->convertResourceToArray (
150
150
$ resource ,
151
- $ resource ->isShowSelf (),
151
+ $ resource ->getResourceLinks (),
152
152
$ resource ->getPrimaryMeta (),
153
153
$ isShowAttributes
154
154
);
@@ -165,7 +165,7 @@ public function convertIncludedResourceToArray(ResourceObjectInterface $resource
165
165
{
166
166
return $ this ->convertResourceToArray (
167
167
$ resource ,
168
- $ resource ->isShowSelfInIncluded (),
168
+ $ resource ->getIncludedResourceLinks (),
169
169
$ resource ->getInclusionMeta (),
170
170
$ resource ->isShowAttributesInIncluded ()
171
171
);
@@ -277,13 +277,13 @@ private function getRelationRepresentation(
277
277
* Convert resource object to array.
278
278
*
279
279
* @param ResourceObjectInterface $resource
280
- * @param bool $isShowSelf
280
+ * @param array $resourceLinks
281
281
* @param mixed $meta
282
282
* @param bool $isShowAttributes
283
283
*
284
284
* @return array
285
285
*/
286
- private function convertResourceToArray (ResourceObjectInterface $ resource , $ isShowSelf , $ meta , $ isShowAttributes )
286
+ private function convertResourceToArray (ResourceObjectInterface $ resource , $ resourceLinks , $ meta , $ isShowAttributes )
287
287
{
288
288
$ representation = [
289
289
Document::KEYWORD_TYPE => $ resource ->getType (),
@@ -304,9 +304,12 @@ private function convertResourceToArray(ResourceObjectInterface $resource, $isSh
304
304
// links and meta which is not visually beautiful
305
305
$ representation [Document::KEYWORD_RELATIONSHIPS ] = null ;
306
306
307
- if ($ isShowSelf === true ) {
308
- $ representation [Document::KEYWORD_LINKS ][Document::KEYWORD_SELF ] =
309
- $ this ->getLinkRepresentation ($ this ->document ->getUrlPrefix (), $ resource ->getSelfSubLink ());
307
+ if (empty ($ resourceLinks ) === false ) {
308
+ foreach ($ resourceLinks as $ linkName => $ link ) {
309
+ /** @var LinkInterface $link */
310
+ $ representation [Document::KEYWORD_LINKS ][$ linkName ] =
311
+ $ this ->getLinkRepresentation ($ this ->document ->getUrlPrefix (), $ link );
312
+ }
310
313
}
311
314
312
315
if ($ meta !== null ) {
0 commit comments