@@ -30,7 +30,7 @@ final class ItemNormalizer extends AbstractItemNormalizer
30
30
public function denormalize ($ data , $ class , $ format = null , array $ context = [])
31
31
{
32
32
// Avoid issues with proxies if we populated the object
33
- if (isset ($ data ['id ' ]) && !isset ($ context [' object_to_populate ' ])) {
33
+ if (isset ($ data ['id ' ]) && !isset ($ context [self :: OBJECT_TO_POPULATE ])) {
34
34
if (isset ($ context ['api_allow_update ' ]) && true !== $ context ['api_allow_update ' ]) {
35
35
throw new InvalidArgumentException ('Update is not allowed for this operation. ' );
36
36
}
@@ -44,7 +44,7 @@ public function denormalize($data, $class, $format = null, array $context = [])
44
44
private function updateObjectToPopulate (array $ data , array &$ context )
45
45
{
46
46
try {
47
- $ context [' object_to_populate ' ] = $ this ->iriConverter ->getItemFromIri ((string ) $ data ['id ' ], $ context + ['fetch_data ' => true ]);
47
+ $ context [self :: OBJECT_TO_POPULATE ] = $ this ->iriConverter ->getItemFromIri ((string ) $ data ['id ' ], $ context + ['fetch_data ' => true ]);
48
48
} catch (InvalidArgumentException $ e ) {
49
49
$ identifier = null ;
50
50
foreach ($ this ->propertyNameCollectionFactory ->create ($ context ['resource_class ' ], $ context ) as $ propertyName ) {
@@ -58,7 +58,7 @@ private function updateObjectToPopulate(array $data, array &$context)
58
58
throw $ e ;
59
59
}
60
60
61
- $ context [' object_to_populate ' ] = $ this ->iriConverter ->getItemFromIri (sprintf ('%s/%s ' , $ this ->iriConverter ->getIriFromResourceClass ($ context ['resource_class ' ]), $ data [$ identifier ]), $ context + ['fetch_data ' => true ]);
61
+ $ context [self :: OBJECT_TO_POPULATE ] = $ this ->iriConverter ->getItemFromIri (sprintf ('%s/%s ' , $ this ->iriConverter ->getIriFromResourceClass ($ context ['resource_class ' ]), $ data [$ identifier ]), $ context + ['fetch_data ' => true ]);
62
62
}
63
63
}
64
64
}
0 commit comments