Re: DataObjects , problem with unique field and new versions
| From: | Alan Knowles | Date: | Fri, 30 May 2003 01:00:10 +0000 |
| Subject: | Re: DataObjects , problem with unique field and new versions | ||
| References: | 1 | Groups: | php.pear.general php.pear.general |
| Request: | Send a blank email to pear-general+get-5693@lists.php.net to get a copy of this message | ||
Until DO's has a real database description, it's going to get stuff like that wrong unfortunaly, it's probably worth removing webuser_Email from the database.ini file manually - and remembering to do it again when you regenerate..
Regards
Alan
Xavier wrote:
Hi there,
i'me experiencing a trouble with latest versions on DataObjects.
here it is:
I got a postgresql table , it looks like :
-- Table: public.t_webusers
CREATE TABLE public.t_webusers (
usr_id int8 NOT NULL,
usr_email varchar(100),
usr_telephone varchar(20),
usr_date_enreg timestamp,
usr_date_maj timestamp,
CONSTRAINT webuser_email UNIQUE (usr_email),
CONSTRAINT pk_t_webusers PRIMARY KEY (usr_id),
) WITH OIDS;
so i have a primary Key (usr_id) and a field which is a Unique key.
When calling setFrom() method, and after insert() , the usr_email field is not feeded.
The behaviour had been added since 0.18 and is located in DataObject.php line : 1801
if (in_array($k,$keys)) {
continue; // dont overwrite keys
}
if (!$k) {
continue; // ignore empty keys!!! what
}
This behaviour should be applyed only on Primary keys or is recommended for Unique keys too ?
Regards
-- Xavier