mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-05-26 02:58: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)
|
* @param mixed $obj Object reference (gets filled with insert id)
|
||||||
*
|
*
|
||||||
* @return int Status
|
* @return mixed
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public static function update($obj) : int;
|
public static function update($obj);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete data.
|
* Delete data.
|
||||||
|
|
|
||||||
|
|
@ -346,7 +346,7 @@ class DataMapperAbstract implements DataMapperInterface
|
||||||
{
|
{
|
||||||
self::extend(__CLASS__);
|
self::extend(__CLASS__);
|
||||||
|
|
||||||
if ($obj === null ||
|
if (!isset($obj) ||
|
||||||
(strpos($className = get_class($obj), '\Null') !== false && is_object($obj))
|
(strpos($className = get_class($obj), '\Null') !== false && is_object($obj))
|
||||||
) {
|
) {
|
||||||
return null;
|
return null;
|
||||||
|
|
@ -1152,14 +1152,18 @@ class DataMapperAbstract implements DataMapperInterface
|
||||||
* @param mixed $obj Object reference (gets filled with insert id)
|
* @param mixed $obj Object reference (gets filled with insert id)
|
||||||
* @param int $relations Create all relations as well
|
* @param int $relations Create all relations as well
|
||||||
*
|
*
|
||||||
* @return int
|
* @return mixed
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @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__);
|
self::extend(__CLASS__);
|
||||||
|
|
||||||
|
if(!isset($obj) || strpos(get_class($obj), '\Null') !== false) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
$reflectionClass = new \ReflectionClass($obj);
|
$reflectionClass = new \ReflectionClass($obj);
|
||||||
$objId = self::getObjectId($obj, $reflectionClass);
|
$objId = self::getObjectId($obj, $reflectionClass);
|
||||||
$update = true;
|
$update = true;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user