DB_DataObject::staticGet()
Вернуться к: DB_DataObject
DB_DataObject::staticGet()
Synopsis
mixed DB_DataObject::staticGet ( string $class , mixed $key or $value , mixed $value )
This method is depreciated, it is recommended to use ::factory() and ->get()
The static method is a combination of factory and get(). staticGet() will cache the returned data in a global variable for quick access within the same request (any data modification query will clear the cache).
Parameter
-
string $class - class name
-
string $key - column (or value if only 2 parameters are given)
-
mixed $value - value
Return value
object mixed - FALSE or the object
Throws
Error code | Error message | Meaning | Solution |
---|---|---|---|
DB_DATAOBJECT_ERROR_NOCLASS | "could not autoload $class" | ||
DB_DATAOBJECT_ERROR_NOCLASS | "Error creating $newclass" | ||
DB_DATAOBJECT_ERROR_NODATA | "No Data return from get $key $value" |
Note
This method must be called statically.
Example
Simple fetch of data based on Primary Key or column and value
<?php
$person = DB_DataObject::staticGet('DataObjects_Person', 12);
print_r($person);
$person = DB_DataObject::staticGet('DataObjects_Person', 'name', 'fred');
print_r($person);
?>
Вернуться к: DB_DataObject