In OrientDB, I define a vertex CustomFields with 'fields' property is EMBEDEDLIST.
But when I insert or update record, it considered as STRING.
So, I modified your source following bellow:
1.Modify Sgpatil\Orientdb\Query\Grammars\Grammar::parameter() function for update:
public function parameter($value)
{
...
if (is_string($property) && is_array(json_decode($property, true)) && (json_last_error() == JSON_ERROR_NONE))
return $property;
return "'" . $property . "'";
}
Modify Sgpatil\Orientdb\Query\Grammars\CypherGrammar::compileInsert() function for insert:
public function compileInsert(Builder $query, array $values)
{
...
foreach ($values as $value) {
$col_values = [];
foreach ($value as $val) {
if (is_bool($val)) {
// For the boolean column this need to be un-quote unless orientdb will reject
$col_values[] = $val ? 'true' : 'false';
} else if(is_string($val) && is_array(json_decode($val, true)) && (json_last_error() == JSON_ERROR_NONE)){
// For json value
$col_values[] = $val;
} else {
// Escape variable for security
$val = str_replace(array('\\', "\0", "\n", "\r", "'", '"', "\x1a"), array('\\\\', '\\0', '\\n', '\\r', "\\'", '\\"', '\\Z'), $val);
$col_values[] = "'" . $val . "'";
}
}
$rows[] = implode(',', $col_values);
}
$parameters = "(" . implode('), (', $rows) . ")";
return "insert into $table ($columns) values $parameters";
}
In OrientDB, I define a vertex CustomFields with 'fields' property is EMBEDEDLIST. But when I insert or update record, it considered as STRING. So, I modified your source following bellow: 1.Modify
Sgpatil\Orientdb\Query\Grammars\Grammar::parameter()
function for update:Sgpatil\Orientdb\Query\Grammars\CypherGrammar::compileInsert()
function for insert:It's right? I need help soon.