Hi,

thanks for your reply. The data field was set to null before. If I
update a dataset and assigning the null value to a the birthday field
(SET birthday=null) it works fine. So I added the following code to my
controller:
if(empty($this->data['Employee']['birthday']))
        $this->data['Employee']['birthday'] = null;
This works fine, but I'm not sure if this is the proper way to do it?

Regards,
Sebastian

On 16 Dez., 15:13, Alexandru Ciobanu <[email protected]> wrote:
> Sebastian Göttschkes wrote:
> > Hi,
>
> > i got the following problem using cakePHP 1.2 RC3:
>
> > My Model 'Employee' has a attribute called 'birthday' (datatype:
> > DATE). In the add-view, I have the following code:
> > <?= $form->input('birthday',array('type'=>'text'));?>
> > If i left this field blank when adding an employee, this employee has
> > the birthday '0000-00-00' saved in the database. I would rather like
> > the birthday having the null-value, because 0000-00-00 is no valid
> > birthday.
>
> Set the date field to NULL
> |ALTER TABLE `employees` CHANGE `birthday` `birthday` DATE NULL;
>
> IIRC
>
> HTH
> |
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to