Sync: retrieve import format
This commit is contained in:
parent
c456f79c4c
commit
8ccad501e8
|
@ -213,6 +213,7 @@ class Db extends DbConnection
|
|||
array('rp' => 'imported_row_property'),
|
||||
array(
|
||||
'property_value' => 'p.property_value',
|
||||
'format' => 'p.format',
|
||||
'row_checksum' => 'rp.row_checksum'
|
||||
)
|
||||
)->join(
|
||||
|
@ -228,6 +229,7 @@ class Db extends DbConnection
|
|||
|
||||
foreach ($columns as $c) {
|
||||
$fetchColumns[$c] = sprintf('p_%s.property_value', $c);
|
||||
$fetchColumns[$c . '__f'] = sprintf('p_%s.format', $c);
|
||||
$p = clone($propertyQuery);
|
||||
$query->joinLeft(
|
||||
array(sprintf('p_' . $c) => $p->where('p.property_name = ?', $c)),
|
||||
|
|
|
@ -29,6 +29,17 @@ class Sync
|
|||
|
||||
protected function fillVariables($string, $row)
|
||||
{
|
||||
if (preg_match('/^\${([A-Za-z0-9_-]+)}$/', $string, $m)) {
|
||||
$var = $m[1];
|
||||
if (! property_exists($row, $var)) {
|
||||
return null;
|
||||
}
|
||||
if ($row->{$var . '__f'} === 'json') {
|
||||
return json_decode($row->$var);
|
||||
}
|
||||
return $row->$var;
|
||||
}
|
||||
|
||||
$func = function ($match) use ($row) {
|
||||
return $row->{$match[1]};
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue