I have the following codes inside a custom resourceModel class:
protected function _beforeSave(
AbstractModel $object
)
{
//My operations
return parent::_beforeSave($object);
}
I added a checking inside _beforeSave()
but I don't know how to prevent the resuorce model to continue the save actions.
I found this answer but it's for M1. I need a M2 solution.
Cancel save() in custom model if condition is met in _beforeSave()
$this->_dataSaveAllowed = false;
if your condition does not satisy