Preserve existing @reverse map when merging properties.

This commit is contained in:
Dave Longley 2014-07-08 12:59:37 -04:00
parent ea1d54b31d
commit 2245638c1e

View file

@ -2435,7 +2435,11 @@ class JsonLdProcessor {
if(property_exists($active_ctx->mappings, $key) && if(property_exists($active_ctx->mappings, $key) &&
$active_ctx->mappings->{$key} && $active_ctx->mappings->{$key} &&
$active_ctx->mappings->{$key}->reverse) { $active_ctx->mappings->{$key}->reverse) {
$reverse_map = $rval->{'@reverse'} = new stdClass(); if(property_exists($rval, '@reverse')) {
$reverse_map = $rval->{'@reverse'};
} else {
$reverse_map = $rval->{'@reverse'} = new stdClass();
}
$expanded_value = self::arrayify($expanded_value); $expanded_value = self::arrayify($expanded_value);
foreach($expanded_value as $item) { foreach($expanded_value as $item) {
if(self::_isValue($item) || self::_isList($item)) { if(self::_isValue($item) || self::_isList($item)) {