X-Git-Url: https://git.mxchange.org/?p=shipsimu.git;a=blobdiff_plain;f=inc%2Fclasses%2Fmain%2Fdatabase%2Fwrapper%2Fclass_UserDatabaseWrapper.php;h=a9f64d8c0b54c40ad49e6d5225785485fffab231;hp=c8eb465c2b3e313b29cb753dae071d0b832708f3;hb=f952a5fb1fe821dd1ddca875f537dd680019371d;hpb=a2301994f4ec0f0b50f5d9af696f74f9d27e00bf diff --git a/inc/classes/main/database/wrapper/class_UserDatabaseWrapper.php b/inc/classes/main/database/wrapper/class_UserDatabaseWrapper.php index c8eb465..a9f64d8 100644 --- a/inc/classes/main/database/wrapper/class_UserDatabaseWrapper.php +++ b/inc/classes/main/database/wrapper/class_UserDatabaseWrapper.php @@ -103,8 +103,17 @@ class UserDatabaseWrapper extends BaseDatabaseWrapper { // Now it's time to ask the database layer for this select statement $result = $this->getDatabaseInstance()->doSelectByTableCriteria(self::DB_TABLE_USER, $criteriaInstance); - // Cache the result - $this->cacheInstance->offsetSet($cacheKey, $result); + // Cache the result if not null + if (!is_null($result)) { + // A valid result has returned from the database layer + $this->cacheInstance->offsetSet($cacheKey, $result); + } else { + // This invalid result must be wrapped + $result = array( + 'status' => "invalid", + 'exception' => $this->getDatabaseInstance()->getLastException() + ); + } } // Create an instance of a DatabaseResult class with the given result