|
@@ 50-55 (lines=6) @@
|
| 47 |
|
if ($relationships = ArrayHelper::getValue($array, 'data.relationships')) { |
| 48 |
|
foreach ($relationships as $name => $relationship) { |
| 49 |
|
if (isset($relationship[0])) { |
| 50 |
|
foreach ($relationship as $item) { |
| 51 |
|
if (isset($item['type']) && isset($item['id'])) { |
| 52 |
|
$formName = call_user_func($this->formNameCallback, $item['type']); |
| 53 |
|
$result[$name][$formName][] = $item; |
| 54 |
|
} |
| 55 |
|
} |
| 56 |
|
} elseif (isset($relationship['type']) && isset($relationship['id'])) { |
| 57 |
|
$formName = call_user_func($this->formNameCallback, $relationship['type']); |
| 58 |
|
$result[$name][$formName] = $relationship; |
|
@@ 64-69 (lines=6) @@
|
| 61 |
|
} |
| 62 |
|
} else { |
| 63 |
|
$data = ArrayHelper::getValue($array, 'data', []); |
| 64 |
|
foreach ($data as $relationLink) { |
| 65 |
|
if (isset($relationLink['type']) && isset($relationLink['id'])) { |
| 66 |
|
$formName = call_user_func($this->formNameCallback, $relationLink['type']); |
| 67 |
|
$result[$formName][] = $relationLink; |
| 68 |
|
} |
| 69 |
|
} |
| 70 |
|
} |
| 71 |
|
return isset($result) ? $result : $array; |
| 72 |
|
} |