Check if a data already exists in the table.
I want to add a function and my model to validate whether a data exists or not. I did est function
public function beforeSave(){
$valor = SpmContacto::findFirstByCONT_CEDULA($this->CONT_CEDULA);
if (!$valor) {
return TRUE;
}else{
echo "Couldn't find your data. What's up?";
return FALSE;
}
}
But this function does not work. It left me a blank screen. Could you be because apart from a BeforeSave function, I already have a BeforeCreate function?