diff options
author | icewing <icewing@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-04-03 10:16:19 +0000 |
---|---|---|
committer | icewing <icewing@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-04-03 10:16:19 +0000 |
commit | ecd6f2180a5c2d846e15d2205f696f52bce9a575 (patch) | |
tree | 1470a4e3eb2fb7f2cce08f516260f73d839359e6 | |
parent | d599fe0cfb93bad66a194ffd11e44a97867c0fa0 (diff) | |
download | elgg-ecd6f2180a5c2d846e15d2205f696f52bce9a575.tar.gz elgg-ecd6f2180a5c2d846e15d2205f696f52bce9a575.tar.bz2 |
Marcus Povey <marcus@dushka.co.uk>
* Exception thrown if load fails
git-svn-id: https://code.elgg.org/elgg/trunk@389 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r-- | engine/lib/entities.php | 8 | ||||
-rw-r--r-- | engine/lib/objects.php | 7 | ||||
-rw-r--r-- | engine/lib/sites.php | 3 | ||||
-rw-r--r-- | engine/lib/users.php | 3 |
4 files changed, 13 insertions, 8 deletions
diff --git a/engine/lib/entities.php b/engine/lib/entities.php index 4a588368d..60ad89733 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -273,8 +273,8 @@ */ protected function load($guid) { - $row = get_entity_as_row($guid); - + $row = get_entity_as_row($guid); + if ($row) { // Create the array if necessary - all subclasses should test before creating @@ -608,7 +608,9 @@ $query .= " $w and "; $query .= " (access_id in {$access} or (access_id = 0 and owner_guid = {$_SESSION['guid']}))"; // Add access controls $query .= " order by $order_by limit $offset, $limit"; // Add order and limit - $dt = get_data($query, "entity_row_to_elggstar");
+ + $dt = get_data($query, "entity_row_to_elggstar"); +
return $dt; } diff --git a/engine/lib/objects.php b/engine/lib/objects.php index 0a8dffc65..ff8ebd558 100644 --- a/engine/lib/objects.php +++ b/engine/lib/objects.php @@ -44,14 +44,15 @@ */
function __construct($guid = null)
{
- $this->initialise_attributes();
+ $this->initialise_attributes(); if (!empty($guid))
{
// Is $guid is a DB row - either a entity row, or a object table row.
if ($guid instanceof stdClass) {
// Load the rest
- $this->load($guid->guid);
+ if (!$this->load($guid->guid)) + throw new IOException("Failed to load new ElggObject from GUID:$guid->guid");
}
// Is $guid is an ElggObject? Use a copy constructor
@@ -100,7 +101,7 @@ $objarray = (array) $row;
foreach($objarray as $key => $value)
$this->attributes[$key] = $value;
-
+
return true;
}
diff --git a/engine/lib/sites.php b/engine/lib/sites.php index 9f2ae442f..2d9f04f1c 100644 --- a/engine/lib/sites.php +++ b/engine/lib/sites.php @@ -51,7 +51,8 @@ // Is $guid is a DB row - either a entity row, or a site table row. if ($guid instanceof stdClass) { // Load the rest - $this->load($guid->guid); + if (!$this->load($guid->guid)) + throw new IOException("Failed to load new ElggSite from GUID:$guid->guid"); } // Is $guid is an ElggSite? Use a copy constructor diff --git a/engine/lib/users.php b/engine/lib/users.php index cc293c411..edf2974c1 100644 --- a/engine/lib/users.php +++ b/engine/lib/users.php @@ -54,7 +54,8 @@ // Is $guid is a DB row - either a entity row, or a user table row.
if ($guid instanceof stdClass) {
// Load the rest
- $this->load($guid->guid);
+ if (!$this->load($guid->guid)) + throw new IOException("Failed to load new ElggUser from GUID:$guid->guid");
}
// See if this is a username
|