I can’t see how transactions works in activeRecord, in the docs:
class Post extends \yii\db\ActiveRecord
{
public function transactions()
{
return [
'admin' => self::OP_INSERT,
'api' => self::OP_INSERT | self::OP_UPDATE | self::OP_DELETE,
// the above is equivalent to the following:
// 'api' => self::OP_ALL,
];
}
}
My DML actions will only be in transaction if I use those methods?
I’ve my own method for saving models (specific for my project) in my model, so I’m not protected with transaction? Because they need to be in those exactly methods?
@samdark Thanks! Yes, it’s custom. (If not, I needed the method afterSave to have parameters, perhaps its worth changing the core to use the transaction ‘layer’)
@stefano This seems interesting, I’ll see if its worth the implementation for my case. Thanks!