PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Database » DB_DataObject » Bug #2116

$object->toArray not "arrayizing" all elements (Part 2)

Details

Submitted2004-08-12 16:28 UTC
Fromasnagy at php dot net
StatusNo Feedback
PackageDB_DataObject
PHP Version4.3.7
OSLinux
Roadmaps(Not assigned)

Comments

[2004-08-12 16:28 UTC] asnagy at php dot net

Description:
------------
I am using DB_DataObject 1.7.1 and I am using a MySQL database. One of my columns is of type "Set". When I call toArray() the value in this column is not kept.

Actual result:
--------------
journal Object
(
[_DB_DataObject_version] => 1.7.1
[__table] => journal
[N] => 53
[_database_dsn] =>
[_database_dsn_md5] => daa462c105e5690bb875726b429343eb
[_database] => libSGR
[_query] => Array
(
[condition] =>
[group_by] =>
[order_by] => ORDER BY issn ASC
[having] =>
[limit] =>
[data_select] => *
)

[_DB_resultid] => 1
[_link_loaded] =>
[_join] =>
[_lastError] =>
[issn] => 00020729
[callnumber] => RC952 .A13
[title] => Age and ageing
[holding] =>
[status] =>
[format] => Electronic
[department_id] =>
[cost] =>
[location] =>
)

Array
(
[issn] => 00020729
[callnumber] => RC952 .A13
[title] => Age and ageing
[holding] =>
[status] =>
[format] =>
[department_id] =>
[cost] =>
[location] =>
)

[2004-11-16 20:07 UTC] asnagy at webitecture dot org

I am now using DO 1.7.2 and my table has been updated a bit, but pretty much still the same:

The field "format" is of type "Set" with 3 options.

Here is the ini file:
[resource]
id = 129
standard_number = 130
callnumber = 2
title = 130
holding = 2
status = 1
format = 130
department_id = 1
cost = 1
location = 2
type_id = 129

Here is the create script:
CREATE TABLE `resource` (
`id` int(11) NOT NULL auto_increment,
`standard_number` varchar(20) NOT NULL default '',
`callnumber` varchar(50) default NULL,
`title` varchar(200) NOT NULL default '',
`holding` varchar(100) default NULL,
`status` tinyint(4) default NULL,
`format` set('Electronic','Print','Microfilm') NOT NULL default 'Electronic',
`department_id` int(11) default NULL,
`cost` double default NULL,
`location` varchar(100) default NULL,
`type_id` int(11) NOT NULL default '0',
PRIMARY KEY (`id`)
)

Here is my results:
resource Object
(
[_DB_DataObject_version] => 1.7.2
[__table] => resource
[N] => 27
[_database_dsn] =>
[_database_dsn_md5] => eb8bf4877f5e951f4eb46d5f0efbf157
[_database] => libSGR2
[_DB_resultid] => 1
[_link_loaded] =>
[_join] =>
[_lastError] =>
[id] => 1
[standard_number] => NULL
[callnumber] =>
[title] => ATLA Religion Database
[holding] =>
[status] =>
[format] => Electronic
[department_id] =>
[cost] =>
[location] =>
[type_id] => 2
)

Array
(
[id] => 1
[standard_number] => NULL
[callnumber] =>
[title] => ATLA Religion Database
[holding] =>
[status] =>
[format] =>
[department_id] =>
[cost] =>
[location] =>
[type_id] => 2
)

Here is my code that generates the results

$resource = new Resource();
if ($resource->find()) {
while ($resource->fetch()) {
print_r($resource);
print_r($resource->toArray());
}
}

I appreciate any help in pin-pointing this problem.