diff options
author | Christian Weber | 2012-07-11 13:19:34 +0000 |
---|---|---|
committer | Christian Weber | 2012-07-11 13:19:34 +0000 |
commit | fad7667930db46129701982d9b0e34263a64c9fa (patch) | |
tree | e0c0a70d918a0089f3a42faf25dba4e13d9230b6 /it_dbi.class | |
parent | 6b15ec70ec0e246b0f7a6e4cfa52bddadb971e95 (diff) | |
download | itools-fad7667930db46129701982d9b0e34263a64c9fa.tar.gz itools-fad7667930db46129701982d9b0e34263a64c9fa.tar.bz2 itools-fad7667930db46129701982d9b0e34263a64c9fa.zip |
implement static function get() as discussed
Diffstat (limited to 'it_dbi.class')
-rw-r--r-- | it_dbi.class | 11 |
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 */ ?> |