Skip to content

Instantly share code, notes, and snippets.

@neohunter
Created August 27, 2012 05:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neohunter/3485780 to your computer and use it in GitHub Desktop.
Save neohunter/3485780 to your computer and use it in GitHub Desktop.
function beforeSave(){
$d = &$this->data[$this->alias];
if ( !$this->id && !isset($d['id']) ) {
//check if we already have that phone register (would be an update)
$id = $this->field('id', array('phone' => $d['phone']));
$this->id = $d['id'] = $id;
}
if(isset($d['phone']))
$d['phone'] = $this->escapePhone($d['phone']);
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment