Reputation: 3278
I have a User model which hasMany Orders and many Articles. If I want to delete a User record I go by record.remove() if I'm not mistaken but how do I delete all orders of this user for example?
Logically I would go by record.getAssociatedData('orders').remove() but 'getAssociatedData' does not accept any parameters.
Any help is much appreciated.
Upvotes: 1
Views: 540
Reputation: 113
This may be ok for fetching data but not for deleting! This action belongs to the DataBase or at least the server. It is really bad to do the referential integrity on the client! Don't to this.
Upvotes: 1