I am running some code in my Model, which does the following:
public function beforeSave()
{
$this->parent_exists = FALSE;
// search for existing parent..
$existing_parent = Myparents::model()->findByAttributes(array('email' => $this->email)); //
if (isset($existing_parent) && is_object($existing_parent))
{
// WHERE I AM STUCK...
// need to disable/override the save() to prevent the INSERT into the table
} else {
// proceed as normal with the 'normal' save() method
}
}
Can anyone explain how I prevent the INSERT query from happening via the save() method when the IF statement is true but if the statement is FALSE proceed as normal with the save()
Any ideas?