This makes it nice an easy to filter (i.e. remove) empty fields Nate,
but it would be great to see Cake help developers maintain proper
database state. i.e.:

- change #2092 from allowBlank to allowNull

- in save() set any empty (as in they are set to an empty string)
fields to null, so the database column is set to NULL

I know this can all be done manually with regexp and beforeSave() -
but it really should be default behaviour.

Sorry if that sounds a bit rantish - but empty strings vs null (and
the lack of understanding thereof) cause me sooo many problems on
clients' legacy databases...

~GreyCells (aka TheDatabasePedant)

On Apr 18, 11:59 pm, nate <[EMAIL PROTECTED]> wrote:
> As of 1.2 current SVN:
>
> function beforeValidate() {
>    $this->data[$this->name] = Set::filter($this->data[$this->name],
> true);
>    return true;
>
> }
>
> Works for me.
>
> On Apr 18, 5:18 pm, rtconner <[EMAIL PROTECTED]> wrote:
>
> > Wow did you pick an ambiguous name for that then. Holy misleading
> > batman.
>
> > So how the heck do I do what I want to do? I can't help but think
> > enhancement/bug # 2092 is a "must have". I can't even think of a
> > workaround at the moment.
>
> > On Apr 18, 3:05 pm, nate <[EMAIL PROTECTED]> wrote:
>
> > > It technically means "allowNotPresent" as in "not present in the array
> > > of data to be saved", but I felt that was too cumbersome.
>
> > > rtconner wrote:
> > > > Hello, (in 1.2) does anyone know what the intended behavior of
> > > > alowEmpty should be in the validate array in a model?
>
> > > > You would think it would set the behavior to allow you to submit an
> > > > empty string that passes validation. For example, you may either pass
> > > > a valid phone number, or not send one at all. This was 'asdasda' does
> > > > not count as a phone number, but the phone number is not a required
> > > > field also.
>
> > > > ..but this is not the behavior I am seeing. As far as I can tell
> > > > allowEmpty does nothing to change the behavior. Actually I looked at
> > > > the code in model and yes the code does not implement this behavior
> > > > either. I'm trying to determine if this is a bug or not.
>
> > > > So... how should allowEmpty cause things to behave?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to