aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-07-15 10:25:05 +0000
committermarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-07-15 10:25:05 +0000
commitee6d78d6f6c1d6079a17ada31d6dd7bd53024bc1 (patch)
tree41a9434716350e778ab5b5fa89e60405ba5bc3d5
parent6fa0ee7509f3e59b67477b554dce82a873cab95b (diff)
downloadelgg-ee6d78d6f6c1d6079a17ada31d6dd7bd53024bc1.tar.gz
elgg-ee6d78d6f6c1d6079a17ada31d6dd7bd53024bc1.tar.bz2
Entity metadata can now be saved using setMetaData() interface even if guid not specified.
git-svn-id: https://code.elgg.org/elgg/trunk@1420 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r--engine/lib/entities.php15
1 files changed, 13 insertions, 2 deletions
diff --git a/engine/lib/entities.php b/engine/lib/entities.php
index 7b5383dee..ad78b6f9e 100644
--- a/engine/lib/entities.php
+++ b/engine/lib/entities.php
@@ -192,13 +192,24 @@
remove_metadata($this->getGUID(), $name);
$multiple = true;
foreach ($value as $v) {
- if (!create_metadata($this->getGUID(), $name, $v, $value_type, $this->getOwner(), $this->getAccessID(), $multiple)) return false;
+ if ((int) $this->guid > 0) {
+ if (!create_metadata($this->getGUID(), $name, $v, $value_type, $this->getOwner(), $this->getAccessID(), $multiple)) return false;
+ } else {
+ $this->temp_metadata[$name] = $value;
+ }
}
return true;
}
else
- return create_metadata($this->getGUID(), $name, $value, $value_type, $this->getOwner(), $this->getAccessID());
+ {
+ if ((int) $this->guid > 0) {
+ return create_metadata($this->getGUID(), $name, $value, $value_type, $this->getOwner(), $this->getAccessID());
+ } else {
+ $this->temp_metadata[$name] = $value;
+ return true;
+ }
+ }
}
/**