Hi everyone,
I have been trying to figure out why the beforeCreate event handler is not being triggered when saving an object with the UnitOfWork/transaction API.
I am using Swift / developing for iOS and have noticed that a singular save() event does trigger the cloud code events as expected, however, when using the equivalent unitofwork.create() method within a transaction, the cloud code event handlers are seemingly not notified.
For example, the following works as expected:
Backendless.shared.data.of(MyClass.self).save(entity: instanceOfMyClass, responseHandler: { savedObject in
print(“Object has been saved: (savedObject)”)
}, errorHandler: { fault in
print(“Error: (fault.message ?? “”)”)
})
}
The following does not:
let unitOfWork = UnitOfWork()
let createMyObjectResult = unitOfWork.create(objectToSave: myObject)
…execute etc.
Any clarity would be appreciated,
Thanks