PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Database » DB_DataObject » Bug #35

subsequent get() calls only update 'id' field

Details

Submitted2003-09-25 19:32 UTC
Fromieure at debian dot org
StatusBogus
PackageDB_DataObject
PHP Version4.3.2
OSDebian unstable
Roadmaps(Not assigned)

Comments

[2003-09-25 19:32 UTC] ieure at debian dot org

Description:
------------
If I create a single DataObject, and call get() twice with two different
keys, the only field updated after the second get() is the first key from
$keys.


this is what's in my database:

database=# select id, firstname, lastname, username from users;
id | firstname | lastname | username
----+-----------+----------+----------
14 | Ian | Eure | ieure
18 | Test | User | test
(2 rows)

Reproduce code:
---------------
$o = new DataObjects_Users;
$o->get(14);
print_r($o);
$o->get(18);
print_r($o);

Expected result:
----------------
I expect $o to contain all the correct fields corresponding to user 18 in
the database, e.g.

$o->firstname = 'Test';
$o->lastname = 'User;
$o->username = 'test';

Actual result:
--------------
$o->id contains '18', and the rest of the fields contain the values from
object '14'.

e.g.
$o->firstname = 'Ian';
$o->lastname = 'Eure';
$o->username = 'ieure';

[2005-04-08 21:56 UTC] tom at gocom dot ca

I recently tried to do the same thing. Read documentation, and yes, the object performs as specified. None the less, multiple gets would be logical building out of the object and should be considered in a future version. I love what you have done so far, but I hate to reach a point where the benefit of getting more functionality requires me to build my own dataobject. I would rather build on your well thought out foundation. I am willing to code a solution if you integrate it into the package.