DataObjects Insert Problem

From: Date: Sat, 16 Nov 2002 11:24:19 +0000
Subject: DataObjects Insert Problem
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-2740@lists.php.net to get a copy of this message
Hi there... I'm having a bit of a problem using the insert() method on some of my objects. I'm manually setting the primary key, because it's actually two rows- both "user_id" and "order_id". So, I want the "user_id" field to stay consistent, but the "order_id" field should increment based on the contents of the "user_id" field. That way, orders will be numbered according to user, ie. user_id=1, order_id=1; user_id=1, order_id=2...user_id=2, order_id=1... etc... Everything seems fine until I call the insert() method on my object... after this, its fields which are listed in the database.ini file as keys are reset to "0". I tried the same method on another type of object which uses an auto_increment field as its primary key, and the key was returned properly upon insert. It should be noted that the data is properly inserted into the database, but the object variables corresponding to the primary key(s) are reset (I assume they're being passed NULL keys which are then cast to integers, the end result being variables assigned a value of zero). What could be causing this? I suppose I could keep copies of all my explicitly assigned keys and just put them into the object after it's inserted, but this would be a major kludge, and would defeat the purpose of simplifying my code (which is why I'm using dataobjects in the first place). Thanks in advance, Leigh Caplan maelman@u.washington.edu

« previous php.pear.general (#2740) next »