array $DB_DataObject->toArray (
string $format = '%s'
,
bool $hideEmpty
= false
)
Allows the fetching of an associate array (with optional key formating) for use with other packages, like HTML_QuickForm.
From PHP4.2.3RC2 onwards, The values of each column are retrieved using getXXXX() methods so you can change the formating of a row by defining a getter method.
string $format
- a sprintf string eg. 'form[%s]'
bool $hideEmpty
- If set to true, empty elements (no value/null) will not be returned
This function can not be called statically.
getting arrays
<?php
$person = new DataObjects_Person;
$person->get(2);
print_r($person->toArray());
print_r($person->toArray('user[%s]'));
print_r($person->toArray('user[%s]', true));
?>
Sample Output