From f9e71e5a9ea6f5fd215691737119ef150c480298 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Thu, 26 Nov 2020 21:57:58 +0100 Subject: [PATCH] minor structure optimizations --- DataStorage/Database/DataMapperAbstract.php | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/DataStorage/Database/DataMapperAbstract.php b/DataStorage/Database/DataMapperAbstract.php index c035d4c68..9490f6db4 100644 --- a/DataStorage/Database/DataMapperAbstract.php +++ b/DataStorage/Database/DataMapperAbstract.php @@ -955,11 +955,7 @@ class DataMapperAbstract implements DataMapperInterface $mapper = static::$ownsOne[$propertyName]['mapper']; $primaryKey = $obj[static::$columns[static::$primaryField]['internal']]; - if (empty($primaryKey)) { - return $mapper::createArray($obj); - } - - return $primaryKey; + return empty($primaryKey) ? $mapper::createArray($obj) : $primaryKey; } /** @@ -984,11 +980,7 @@ class DataMapperAbstract implements DataMapperInterface $mapper = static::$belongsTo[$propertyName]['mapper']; $primaryKey = $mapper::getObjectId($obj); - if (empty($primaryKey)) { - return $mapper::create($obj); - } - - return $primaryKey; + return empty($primaryKey) ? $mapper::create($obj) : $primaryKey; } /** @@ -1009,11 +1001,7 @@ class DataMapperAbstract implements DataMapperInterface $mapper = static::$belongsTo[$propertyName]['mapper']; $primaryKey = $obj[static::$columns[static::$primaryField]['internal']]; - if (empty($primaryKey)) { - return $mapper::createArray($obj); - } - - return $primaryKey; + return empty($primaryKey) ? $mapper::createArray($obj) : $primaryKey; } /** @@ -1598,7 +1586,6 @@ class DataMapperAbstract implements DataMapperInterface } self::updateModel($obj, $objId, $refClass, $depth); - self::clear(); return $objId;