I'm not sure this will work (or if it's the best way) but have a lok
at the 3rd param for Model::save, $fieldList. I suppose you could
create an array from the return of schema() (using just the main keys,
I mean) and unset those fields that were not answered by the user and
pass that to save().

On Mon, Apr 6, 2009 at 9:43 AM, cheeser...@googlemail.com
<cheeser...@googlemail.com> wrote:
>
> 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 cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to