mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-03-07 08:28:41 +00:00
Fix update null/null objs
This commit is contained in:
parent
e556fbed49
commit
9a460a2dc7
|
|
@ -47,11 +47,11 @@ interface DataMapperInterface
|
|||
*
|
||||
* @param mixed $obj Object reference (gets filled with insert id)
|
||||
*
|
||||
* @return int Status
|
||||
* @return mixed
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public static function update($obj) : int;
|
||||
public static function update($obj);
|
||||
|
||||
/**
|
||||
* Delete data.
|
||||
|
|
|
|||
|
|
@ -346,7 +346,7 @@ class DataMapperAbstract implements DataMapperInterface
|
|||
{
|
||||
self::extend(__CLASS__);
|
||||
|
||||
if ($obj === null ||
|
||||
if (!isset($obj) ||
|
||||
(strpos($className = get_class($obj), '\Null') !== false && is_object($obj))
|
||||
) {
|
||||
return null;
|
||||
|
|
@ -1152,14 +1152,18 @@ class DataMapperAbstract implements DataMapperInterface
|
|||
* @param mixed $obj Object reference (gets filled with insert id)
|
||||
* @param int $relations Create all relations as well
|
||||
*
|
||||
* @return int
|
||||
* @return mixed
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public static function update($obj, int $relations = RelationType::ALL) : int
|
||||
public static function update($obj, int $relations = RelationType::ALL)
|
||||
{
|
||||
self::extend(__CLASS__);
|
||||
|
||||
if(!isset($obj) || strpos(get_class($obj), '\Null') !== false) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$reflectionClass = new \ReflectionClass($obj);
|
||||
$objId = self::getObjectId($obj, $reflectionClass);
|
||||
$update = true;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user