Thanks for the response,

Here is what I did, in case it proves useful:

my app_model.php:

<?php

class AppModel extends Model {

  var $empty_to_null;

  function beforeSave()
  {
    if (is_array($this->empty_to_null)) {
      foreach ($this->empty_to_null as $model => $fields) {
        foreach ($fields as $field) {
          if (isset($this->data[$model][$field])&&
              trim($this->data[$model][$field]) == '') {
            $this->data[$model][$field] = null;
          }
        }
      }
    }
    return true;
  }

}

?>


--~--~---------~--~----~------------~-------~--~----~
 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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to