Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Saving model passing to other class

Hello, I'd like to use a saver class to store model and do some actions within a transactions, like on user registration page Id like to use like

$userModel = new User([....]);
$saver = new SaverClass($userModel);
$saver->save();

SaverClass.php would look like


SaverClass {
    __construct($model)

    save()
    {
        ...do something
        $this->model->save(); <-- this part is not working for some reason and no exceptions and erros appear anywhere in log files (php, mysql logs)
        ..do something else
    }
}```


138
Accepted
answer

The problem was not with a model, or anything like that. ColumnMap was wrong and it dies silently in this case.