This commit is contained in:
Dennis Eichhorn 2018-12-16 11:22:27 +01:00
parent 857970c230
commit 4ed4caf55b
2 changed files with 6 additions and 7 deletions

View File

@ -1386,19 +1386,16 @@ class DataMapperAbstract implements DataMapperInterface
self::addInitialized(static::class, $objId, $obj);
if (empty($objId)) {
$update = false;
self::create($obj, $relations);
}
if ($relations === RelationType::ALL) {
self::updateHasMany($refClass, $obj, $objId, --$depth);
}
if ($update) {
self::updateModel($obj, $objId, $refClass, --$depth);
if (empty($objId)) {
return self::create($obj, $relations);
}
self::updateModel($obj, $objId, $refClass, --$depth);
return $objId;
}

View File

@ -316,6 +316,8 @@ class Grammar extends GrammarAbstract
return \rtrim(\rtrim(\number_format($value, 5, '.', ''), '0'), '.');
} elseif ($value instanceof Column) {
return $this->compileSystem($value->getColumn(), $prefix);
} elseif ($value instanceof Builder) {
return '(' . \rtrim($value->toSql(), ';') . ')';
} else {
throw new \InvalidArgumentException(\gettype($value));
}