Issues with DB_DataObject toArray
| From: | Andrew Nagy | Date: | Fri, 11 Mar 2005 22:40:00 +0000 |
| Subject: | Issues with DB_DataObject toArray | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-17976@lists.php.net to get a copy of this message | ||
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