->toArray() -- Get an array of the current result
Описание
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.
Заметка
Эта функция не должна вызываться статически.
Пример
Пример 35-1. getting arrays
$person = new DataObjects_Person;
$person->get(2);
print_r($person->toArray());
print_r($person->toArray('user[%s]')); |
|
Пример 35-2. Sample Output
Array
(
[id] => 2
[name] => test
[username] => username
[password] =>
[firstname] => jones
[lastname] =>
)
Array
(
[user[id]] => 2
[user[name]] => test
[user[username]] => username
[user[password]] =>
[user[firstname]] => jones
[user[lastname]] =>
) |
|