aboutsummaryrefslogtreecommitdiff
path: root/engine/lib
diff options
context:
space:
mode:
authorCash Costello <cash.costello@gmail.com>2011-11-27 18:37:33 -0500
committerCash Costello <cash.costello@gmail.com>2011-11-27 18:37:33 -0500
commit3a0043a94076ff8c3f0dc4ac3e195763cb3fc2b5 (patch)
tree010672a25312a09fdcad74feb0346b846f3133f9 /engine/lib
parentda649f2a1d4c3c3b6aaeeb3ba71dd8915b2c56fb (diff)
downloadelgg-3a0043a94076ff8c3f0dc4ac3e195763cb3fc2b5.tar.gz
elgg-3a0043a94076ff8c3f0dc4ac3e195763cb3fc2b5.tar.bz2
fixed some documentation related to subtypes
Diffstat (limited to 'engine/lib')
-rw-r--r--engine/lib/entities.php19
1 files changed, 9 insertions, 10 deletions
diff --git a/engine/lib/entities.php b/engine/lib/entities.php
index d8db88462..f7ae108ed 100644
--- a/engine/lib/entities.php
+++ b/engine/lib/entities.php
@@ -124,8 +124,6 @@ function retrieve_cached_entity_row($guid) {
* @internal Subtypes are stored in the entity_subtypes table. There is a foreign
* key in the entities table.
*
- * @todo Move to a nicer place?
- *
* @param string $type Type
* @param string $subtype Subtype
*
@@ -144,7 +142,7 @@ function get_subtype_id($type, $subtype) {
return FALSE;
}
- // Todo: cache here? Or is looping less efficient that going to the db each time?
+ // @todo use the cache before hitting database
$result = get_data_row("SELECT * from {$CONFIG->dbprefix}entity_subtypes
where type='$type' and subtype='$subtype'");
@@ -163,8 +161,6 @@ function get_subtype_id($type, $subtype) {
/**
* Return string name for a given subtype ID.
*
- * @todo Move to a nicer place?
- *
* @param int $subtype_id Subtype ID
*
* @return string Subtype name
@@ -199,11 +195,11 @@ function get_subtype_from_id($subtype_id) {
}
/**
- * Return a classname for a registered type and subtype.
+ * Return the class name for a registered type and subtype.
*
* Entities can be registered to always be loaded as a certain class
- * with {@link register_entity_subtype()}. This function returns
- * the class name if found, and NULL if not.
+ * with add_subtype() or update_subtype(). This function returns the class
+ * name if found and NULL if not.
*
* @param string $type The type
* @param string $subtype The subtype
@@ -219,7 +215,7 @@ function get_subtype_class($type, $subtype) {
$type = sanitise_string($type);
$subtype = sanitise_string($subtype);
- // Todo: cache here? Or is looping less efficient that going to the db each time?
+ // @todo use the cache before going to the database
$result = get_data_row("SELECT * from {$CONFIG->dbprefix}entity_subtypes
where type='$type' and subtype='$subtype'");
@@ -236,7 +232,7 @@ function get_subtype_class($type, $subtype) {
}
/**
- * Returns the classname for a subtype id.
+ * Returns the class name for a subtype id.
*
* @param int $subtype_id The subtype id
*
@@ -279,6 +275,9 @@ function get_subtype_class_from_id($subtype_id) {
* it will be loaded as that class automatically when retrieved from the database with
* {@link get_entity()}.
*
+ * @warning This function cannot be used to change the class for a type-subtype pair.
+ * Use update_subtype() for that.
+ *
* @param string $type The type you're subtyping (site, user, object, or group)
* @param string $subtype The subtype
* @param string $class Optional class name for the object