Hi Everyone, I'm excited to be embarking on my first project using CakePHP, but unfortunately after only 1 afternoon, I seem to have hit a real problem.
I have several boolean fields in my postgres table which can also take a null value. This is because I want to make a distinction between a user replying 'no' to a question, or just declining to answer it. However, the database layer seems to be automatically converting the NULL values to PHP false values. I guess this is because CakePHP sees that the field is of type 'boolean' and so casts it to a PHP boolean type. I really need this functionality, so I'm considering a few options, but I want to try and do this 'right' and stick to the convention over configuration and MVC philosophies that Cake is built around. What do you think is the best approach? Override functions in the database abstraction layer to make sure NULL values are preserved (although I'm scared this will be difficult and break other stuff). Create a new postgres data type to handle these 'tertiary' values... perhaps a char(1) with the domain restricted to Y,N or X (for null). Set the type to char(1) and build some logic into the controller to ensure that only Y,N,X get inserted.... Could have X as the default value in the database... Or some other approach. I have no idea. Please help! Cheers, Dan --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" 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?hl=en -~----------~----~----~----~------~----~------~--~---
