Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.11.5

Bug #35 subsequent get() calls only update 'id' field
Submitted: 2003-09-25 19:32 UTC
From: ieure at debian dot org Assigned:
Status: Bogus Package: DB_DataObject
PHP Version: 4.3.2 OS: Debian unstable
Roadmaps: (Not assigned)    

 [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';


 [2003-09-25 23:40 UTC] alan_k
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at and the instructions on how to report a bug at see Note: You should avoid calling get on the same object instance twice, as this will result in unexpected results.
 [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.