Something is wrong with booleans and checkboxes when using PostgreSQL.
I created a ticket and made a clear test case as well. See
https://trac.cakephp.org/ticket/1586

Here's what I've found out so far, please correct me if I'm wrong:

$html->checkbox() expects booleans in $this->data in the native format
of the database in use, so '0' / '1' for MySQL and 't' / 'f' for
PostgreSQL.

Checkbox values from POST data are always converted to '0' / '1'.

I couldn't find where CakePHP does the POST data conversion. I also
wonder if changing it will break something else.

In dbo_postgres.php the value() function returns '0' / '1', and
changing that to 't' / 'f' does not solve this problem. Where is this
conversion used, and is it currently correct?

I don't know if this has been brought up before, but I'd question the
design decision to pass data around in controllers and views in the
native database format. If I want cross-database compatibility and need
to code some logic which uses or affects data which is represented
differently in different databases (as booleans are), I'll have to
convert them explicitly every time.

It would seem more natural to use PHP native formats (like TRUE/FALSE
in this case) in the application code, and convert them only just after
reading from or before updating to the database. It would also be
analogous to the transparent way how HTML POST data is handled.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~----------~----~----~----~------~----~------~--~---

Reply via email to