summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Weber2012-07-11 13:19:34 +0000
committerChristian Weber2012-07-11 13:19:34 +0000
commitfad7667930db46129701982d9b0e34263a64c9fa (patch)
treee0c0a70d918a0089f3a42faf25dba4e13d9230b6
parent6b15ec70ec0e246b0f7a6e4cfa52bddadb971e95 (diff)
downloaditools-fad7667930db46129701982d9b0e34263a64c9fa.tar.gz
itools-fad7667930db46129701982d9b0e34263a64c9fa.tar.bz2
itools-fad7667930db46129701982d9b0e34263a64c9fa.zip
implement static function get() as discussed
-rw-r--r--it_dbi.class11
1 files changed, 11 insertions, 0 deletions
diff --git a/it_dbi.class b/it_dbi.class
index fbe9690..3281415 100644
--- a/it_dbi.class
+++ b/it_dbi.class
@@ -874,6 +874,17 @@ function valid()
return (bool)$this->_data;
}
+
+/**
+ * STATIC: create an object and read its record from DB.
+ * @param $id ID of record to read
+ * @return initialized object or null if ID not found
+ */
+static function get($id)
+{
+ return isset($id) && ($rec = new static) && $rec->read($id) ? $rec : null;
+}
+
} /* End class it_dbi */
?>