This is the recommended way to autoload a class, and instantate it. The class is loaded based on
the configuration settings for table to class naming.
Parameter
string $table - the table you want to load
([From Version 1.7.2] if blank, and called on an an instance of a dataobject, it will create a new
instance of that object)
$person = DB_DataObject::factory('person');
if ($person->get(12)) {
print_r($person);
} else {
echo "NO person 12 exists";
}
// it can also be used in a dynamically
class DataObjects_MyTable {
function anExample() {
$person = $this->factory('person');
// supported in version 1.7.2
$another_mytable = $this->factory();
$another_person = $person->factory();
}
}