Re: Issues with DB_DataObject toArray

From: Date: Sat, 12 Mar 2005 06:08:56 +0000
Subject: Re: Issues with DB_DataObject toArray
References: 1  Groups: php.pear.general php.pear.general 
Request: Send a blank email to pear-general+get-17988@lists.php.net to get a copy of this message
toArray() calls toValue() - this does various bits of typecasting.. - can you check the table def for that column (eg. tables(), and var_dump() the output of toValue and directly getting the value Regards Alan On Fri, 2005-03-11 at 17:40 -0500, Andrew Nagy wrote: > I am using the toArray method for DB_DataObject and one of my mysql > fields is set to a tinyint (im used to the bit field in postgres) and I > am using it as a switch. However I extended it to be a 3 way switch > (which may be bad design) and the 3 values are: 1, 0, null. > > When I toArray my DO the 0 and the null are equall (===) > > I read through php's docs on assoc arrays and it says that a false value > should be noted by a 0 integer and a null value is null. > http://us3.php.net/manual/en/language.types.array.php > > Is this a DB_DO bug or a problem elsewhere? > > Here is the snippet of code: > if ($record['status']) { > return '<img src="images/active.gif" alt="Active">'; > } elseif ($record['status'] === 0) { > return '<img src="images/review.gif" alt="Needs > Review">'; > } else { > return '<img src="images/inactive.gif" > alt="Inactive">'; > } > > Andrew

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