Without any argument, it returns the keys used by the object (the generator builds these and guess'es them based on finding things like primary key, unique, or nextval() in the description. Calling it with a value , or mulitple values, sets it for the current instance of the object.
The default keys are is normally stored in the database.ini file described in the Autobuilding section.
$person = new DataObjects_Person; print_r($person->keys()); // // array( // 0 => 'id', // ) // // now use it to define a on the fly database table... $d = new DB_DataObject; $d->tableName('person'); $d->table(array( 'id' => DB_DATAOBJECT_INT, 'name' => DB_DATAOBJECT_STRING, )); $d->keys('id'); // if you have multiple keys // $d->keys('id','key2','key2'); $d->id = 12; $d->find(true); // should do the same as above..!
Deliver First Class Web Sites: 101 Essential Checklists Want to learn how to make your web sites usable and accessible? Want to ensure that your sites meet current best practice, without spending hours trawling through incomprehensible specifications and recommendations from dozens of different books, research papers, and web sites? Want to make sure that the sites you build are "right the first time," requiring no costly redevelopments?