I want to insert a column into my db table, but only if it does not exist, yet.
So I thought I'd check if the model with the specified email exists, and if not I perform save()
method.
Here is what I do:
$customerModel = Mage::getModel('custom/customerobject');
$loadedModel = $customerModel->load($RequestParams['email'],'email');
$customerIsUnique = empty($loadedModel->getData('email'));
if($customerIsUnique)
{
// Do stuff
}
Is this the common way how it's done in magento or is there a better way, like
$customerModel->saveOnlyIfItDoesNotExistOrAnyOtherAwesomeMethod()
?
Thanks in advance