// 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