aboutsummaryrefslogtreecommitdiff
path: root/engine/lib
diff options
context:
space:
mode:
authormarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-07-25 09:54:15 +0000
committermarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-07-25 09:54:15 +0000
commit0e7ce9d8b2da9b81747ae7fcab434934e4618c38 (patch)
treef44bfc00272c3c6f435e42ca03e28be7531141fe /engine/lib
parent9b5a99086ee2a965e2d9c2224c6b42d2d2a4d7c9 (diff)
downloadelgg-0e7ce9d8b2da9b81747ae7fcab434934e4618c38.tar.gz
elgg-0e7ce9d8b2da9b81747ae7fcab434934e4618c38.tar.bz2
Support multiple metadata values on entities, closes #179
git-svn-id: https://code.elgg.org/elgg/trunk@1519 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib')
-rw-r--r--engine/lib/entities.php31
1 files changed, 29 insertions, 2 deletions
diff --git a/engine/lib/entities.php b/engine/lib/entities.php
index e118125cd..2fa00b849 100644
--- a/engine/lib/entities.php
+++ b/engine/lib/entities.php
@@ -198,7 +198,19 @@
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;
+ if (($multiple) && (isset($this->temp_metadata[$name])))
+ {
+ if (!is_array($this->temp_metadata[$name]))
+ {
+ $tmp = $this->temp_metadata[$name];
+ $this->temp_metadata[$name] = array();
+ $this->temp_metadata[$name][] = $tmp;
+ }
+
+ $this->temp_metadata[$name][] = $value;
+ }
+ else
+ $this->temp_metadata[$name] = $value;
}
}
@@ -209,7 +221,22 @@
if ((int) $this->guid > 0) {
return create_metadata($this->getGUID(), $name, $value, $value_type, $this->getOwner(), $this->getAccessID(), $multiple);
} else {
- $this->temp_metadata[$name] = $value;
+ //$this->temp_metadata[$name] = $value;
+
+ if (($multiple) && (isset($this->temp_metadata[$name])))
+ {
+ if (!is_array($this->temp_metadata[$name]))
+ {
+ $tmp = $this->temp_metadata[$name];
+ $this->temp_metadata[$name] = array();
+ $this->temp_metadata[$name][] = $tmp;
+ }
+
+ $this->temp_metadata[$name][] = $value;
+ }
+ else
+ $this->temp_metadata[$name] = $value;
+
return true;
}
}