You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have already created and loaded for all the tables, a behavior very similar to the example in: timestampable.
There, I override the preInsert and preUpdate methods.
That works very well.
Now I need to be able to control this situation:
When doing a DELETE and it fails due to a foreign key constraint, I want to catch the error, and perform a particular action. In my case, perform a "logical delete" (set the "disabled" field of the record to true)
Can this be done with a behavior?
I tried to do it with the postDelete hook, but due to the constraint error, this method does not get executed.
I tried putting a delete function in the behavior, with the intention of overriding that method, but it doesn't seem to work or I didn't do it right.
Can someone tell me how to do this?
The text was updated successfully, but these errors were encountered:
(Translated by Google)
Hello
I have already created and loaded for all the tables, a behavior very similar to the example in: timestampable.
There, I override the preInsert and preUpdate methods.
That works very well.
Now I need to be able to control this situation:
Can this be done with a behavior?
I tried to do it with the postDelete hook, but due to the constraint error, this method does not get executed.
I tried putting a delete function in the behavior, with the intention of overriding that method, but it doesn't seem to work or I didn't do it right.
Can someone tell me how to do this?
The text was updated successfully, but these errors were encountered: