Skip to content

Instantly share code, notes, and snippets.

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']))