mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-03-11 16:35:38 +00:00
getInstance() returns null if object was not found in database
This commit is contained in:
parent
3330085f51
commit
97946893ee
|
@ -58,14 +58,15 @@ class SeedDMS_Core_Group { /* {{{ */
|
|||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Create an instance of a group object
|
||||
* Return an instance of a group object
|
||||
*
|
||||
* @param string|integer $id Id, name of group, depending
|
||||
* on the 3rd parameter.
|
||||
* @param object $dms instance of dms
|
||||
* @param string $by search by group name if set to 'name'.
|
||||
* Search by Id of group if left empty.
|
||||
* @return object instance of class SeedDMS_Core_Group
|
||||
* @return object instance of class SeedDMS_Core_Group if group was found, null
|
||||
* if group was not found, false in case of error
|
||||
*/
|
||||
public static function getInstance($id, $dms, $by='') { /* {{{ */
|
||||
$db = $dms->getDB();
|
||||
|
@ -82,7 +83,7 @@ class SeedDMS_Core_Group { /* {{{ */
|
|||
if (is_bool($resArr) && $resArr == false)
|
||||
return false;
|
||||
else if (count($resArr) != 1) //wenn, dann wohl eher 0 als > 1 ;-)
|
||||
return false;
|
||||
return null;
|
||||
|
||||
$resArr = $resArr[0];
|
||||
|
||||
|
|
|
@ -163,7 +163,8 @@ class SeedDMS_Core_User { /* {{{ */
|
|||
* will check for the 4th paramater and also filter by email. If this
|
||||
* parameter is left empty, the user will be search by its Id.
|
||||
* @param string $email optional email address if searching for name
|
||||
* @return object instance of class SeedDMS_Core_User
|
||||
* @return object instance of class SeedDMS_Core_User if user was found, null
|
||||
* if user was not found, false in case of error
|
||||
*/
|
||||
public static function getInstance($id, $dms, $by='', $email='') { /* {{{ */
|
||||
$db = $dms->getDB();
|
||||
|
@ -183,7 +184,7 @@ class SeedDMS_Core_User { /* {{{ */
|
|||
$resArr = $db->getResultArray($queryStr);
|
||||
|
||||
if (is_bool($resArr) && $resArr == false) return false;
|
||||
if (count($resArr) != 1) return false;
|
||||
if (count($resArr) != 1) return null;
|
||||
|
||||
$resArr = $resArr[0];
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user