aboutsummaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-12-21 13:01:30 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-12-21 13:01:30 +0000
commit7fb204e28b61908eef17bd0a731f01e774f38d36 (patch)
tree0fb36371eaa6332eefb3e18675e753bb31386878 /engine
parent8dc9919079ce498ec4ef5725e67194062a8120a0 (diff)
downloadelgg-7fb204e28b61908eef17bd0a731f01e774f38d36.tar.gz
elgg-7fb204e28b61908eef17bd0a731f01e774f38d36.tar.bz2
fixes #988 - subtype is now available on new entities after being saved
git-svn-id: http://code.elgg.org/elgg/trunk@3777 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine')
-rw-r--r--engine/lib/entities.php10
1 files changed, 8 insertions, 2 deletions
diff --git a/engine/lib/entities.php b/engine/lib/entities.php
index 0954b84aa..adb1a9e37 100644
--- a/engine/lib/entities.php
+++ b/engine/lib/entities.php
@@ -122,7 +122,7 @@ abstract class ElggEntity implements
$this->attributes['tables_split'] = 1;
$this->attributes['tables_loaded'] = 0;
}
-
+
/**
* Return the value of a given key.
* If $name is a key field (as defined in $this->attributes) that value is returned, otherwise it will
@@ -131,6 +131,9 @@ abstract class ElggEntity implements
* Q: Why are we not using __get overload here?
* A: Because overload operators cause problems during subclassing, so we put the code here and
* create overloads in subclasses.
+ *
+ * subtype is returned as an id rather than the subtype string. Use getSubtype()
+ * to get the subtype string.
*
* @param string $name
* @return mixed Returns the value of a given value, or null.
@@ -613,7 +616,7 @@ abstract class ElggEntity implements
if (!((int) $this->guid > 0)) {
return $this->get('subtype');
}
-
+
return get_subtype_from_id($this->get('subtype'));
}
@@ -735,6 +738,9 @@ abstract class ElggEntity implements
unset($this->temp_annotations[$name]);
}
}
+
+ // set the subtype to id now rather than a string
+ $this->attributes['subtype'] = get_subtype_id($this->attributes['type'], $this->attributes['subtype']);
// Cache object handle
if ($this->attributes['guid']) cache_entity($this);