Import: work with data formats
This commit is contained in:
parent
8ccad501e8
commit
0b4bb9979b
|
@ -55,14 +55,22 @@ continue;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$checksum = sha1($key . '=' . json_encode((string) $row->$key), true);
|
$pval = $row->$key;
|
||||||
|
if (is_array($pval)) {
|
||||||
|
$pval = json_encode($pval);
|
||||||
|
$format = 'json';
|
||||||
|
} else {
|
||||||
|
$format = 'string';
|
||||||
|
}
|
||||||
|
|
||||||
|
$checksum = sha1(sprintf('%s=(%s)%s', $key, $format, $pval), true);
|
||||||
|
|
||||||
if (! array_key_exists($checksum, $props)) {
|
if (! array_key_exists($checksum, $props)) {
|
||||||
$props[$checksum] = array(
|
$props[$checksum] = array(
|
||||||
'checksum' => $checksum,
|
'checksum' => $checksum,
|
||||||
'property_name' => $key,
|
'property_name' => $key,
|
||||||
'property_value' => $row->$key,
|
'property_value' => $pval,
|
||||||
'format' => 'string'
|
'format' => $format
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue