->setFrom() -- Copy items from Array or Object (for form posting)
Description
Copies items that are in the table definitions from an
array or object into the current object (It will not override key values).
This can be used to process form posts (if the field names match the database),
or cloning similar objects.
Return value
boolean - true on success
Note
This function can not be called statically
Example
Example 20-1. Using setFrom() $person = new DataObjects_Person;
$person->get(12);
$person->setFrom($_POST['input']);
$person->update();
// or copying from another object
$personA = new DataObjects_Person;
$personA->get(12);
$personB = new DataObjects_Person;
$personB->get(14);
$personA->setFrom($personB);
$person->update(); |
|