|
12 | 12 | namespace NilPortugues\Api\JsonApi\Helpers;
|
13 | 13 |
|
14 | 14 | use NilPortugues\Api\JsonApi\JsonApiTransformer;
|
| 15 | +use NilPortugues\Api\Transformer\Helpers\RecursiveFormatterHelper; |
15 | 16 | use NilPortugues\Serializer\Serializer;
|
16 | 17 |
|
17 | 18 | class DataIncludedHelper
|
@@ -93,7 +94,8 @@ protected static function addToRelationshipsArray(
|
93 | 94 | ) {
|
94 | 95 | foreach ($value as $propertyName => $attribute) {
|
95 | 96 | if (PropertyHelper::isAttributeProperty($mappings, $propertyName, $type)) {
|
96 |
| - $propertyName = DataAttributesHelper::transformToValidMemberName($propertyName); |
| 97 | + |
| 98 | + $propertyName = DataAttributesHelper::transformToValidMemberName(RecursiveFormatterHelper::camelCaseToUnderscore($propertyName)); |
97 | 99 | if (\array_key_exists(Serializer::MAP_TYPE, $attribute)
|
98 | 100 | && count(array_values($attribute[Serializer::SCALAR_VALUE])) > 0
|
99 | 101 | && \array_key_exists(Serializer::CLASS_IDENTIFIER_KEY, array_values($attribute[Serializer::SCALAR_VALUE])[0])) {
|
@@ -223,7 +225,7 @@ protected static function addRelationshipsToIncludedResources(
|
223 | 225 | ) {
|
224 | 226 | foreach ($value as $propertyName => $attribute) {
|
225 | 227 | if (PropertyHelper::isAttributeProperty($mappings, $propertyName, $type)) {
|
226 |
| - $propertyName = DataAttributesHelper::transformToValidMemberName($propertyName); |
| 228 | + $propertyName = DataAttributesHelper::transformToValidMemberName(RecursiveFormatterHelper::camelCaseToUnderscore($propertyName)); |
227 | 229 |
|
228 | 230 | if (\is_array($attribute) && \array_key_exists(Serializer::CLASS_IDENTIFIER_KEY, $attribute)) {
|
229 | 231 | $data[$propertyName][JsonApiTransformer::DATA_KEY] = PropertyHelper::setResponseDataTypeAndId(
|
|
0 commit comments