minor structure optimizations

This commit is contained in:
Dennis Eichhorn 2020-11-26 21:57:58 +01:00
parent 843d97c632
commit f9e71e5a9e

View File

@ -955,11 +955,7 @@ class DataMapperAbstract implements DataMapperInterface
$mapper = static::$ownsOne[$propertyName]['mapper']; $mapper = static::$ownsOne[$propertyName]['mapper'];
$primaryKey = $obj[static::$columns[static::$primaryField]['internal']]; $primaryKey = $obj[static::$columns[static::$primaryField]['internal']];
if (empty($primaryKey)) { return empty($primaryKey) ? $mapper::createArray($obj) : $primaryKey;
return $mapper::createArray($obj);
}
return $primaryKey;
} }
/** /**
@ -984,11 +980,7 @@ class DataMapperAbstract implements DataMapperInterface
$mapper = static::$belongsTo[$propertyName]['mapper']; $mapper = static::$belongsTo[$propertyName]['mapper'];
$primaryKey = $mapper::getObjectId($obj); $primaryKey = $mapper::getObjectId($obj);
if (empty($primaryKey)) { return empty($primaryKey) ? $mapper::create($obj) : $primaryKey;
return $mapper::create($obj);
}
return $primaryKey;
} }
/** /**
@ -1009,11 +1001,7 @@ class DataMapperAbstract implements DataMapperInterface
$mapper = static::$belongsTo[$propertyName]['mapper']; $mapper = static::$belongsTo[$propertyName]['mapper'];
$primaryKey = $obj[static::$columns[static::$primaryField]['internal']]; $primaryKey = $obj[static::$columns[static::$primaryField]['internal']];
if (empty($primaryKey)) { return empty($primaryKey) ? $mapper::createArray($obj) : $primaryKey;
return $mapper::createArray($obj);
}
return $primaryKey;
} }
/** /**
@ -1598,7 +1586,6 @@ class DataMapperAbstract implements DataMapperInterface
} }
self::updateModel($obj, $objId, $refClass, $depth); self::updateModel($obj, $objId, $refClass, $depth);
self::clear(); self::clear();
return $objId; return $objId;