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
{{ message }}
Repository navigation
Feature Request - Add truncate() to repository api #207
I was thinking about to add this method already. However there is one small consideration why Im still not sure about this issue. Repository is a most commonly used class with public api needed for regular work with entities. truncate is more specific method and generally not commonly used, and should be used carefully. Is it a good idea to add such method there?
Cool. I think it logically fits within the CRUD functionality of a Repository or the Entity Manager.
I understand the concern. If it has an explicit name like truncate or removeAll IMO it is pretty clear to me about it's intent. Others might have different opinions...
I think we can add this method. But I don't like truncate name. Looks very mysql-specific for more. Maybe we can came up with better name (which also will be correct for mongodb in the future)?
Also, I've recently come up with a similar edge case. Sometimes I need to delete all data by FK. I.e. delete all orders belong to user X. I think the remove() api only allows for the removal of a single record atm. Would be nice to have the orm take care of this too.
Activity
pleerock commentedon Jan 16, 2017
I was thinking about to add this method already. However there is one small consideration why Im still not sure about this issue.
Repositoryis a most commonly used class with public api needed for regular work with entities.truncateis more specific method and generally not commonly used, and should be used carefully. Is it a good idea to add such method there?dcworldwide commentedon Jan 16, 2017
Cool. I think it logically fits within the CRUD functionality of a Repository or the Entity Manager.
I understand the concern. If it has an explicit name like truncate or removeAll IMO it is pretty clear to me about it's intent. Others might have different opinions...
pleerock commentedon Jan 16, 2017
I think we can add this method. But I don't like
truncatename. Looks very mysql-specific for more. Maybe we can came up with better name (which also will be correct for mongodb in the future)?dcworldwide commentedon Jan 16, 2017
Yeah agree with that. Ideas.... clear(), removeAll()
pleerock commentedon Jan 16, 2017
clearsounds better, but is it descriptive enough name?dcworldwide commentedon Jan 16, 2017
For me yes, reminds me of clearing a collection or array. Others might think differently
dcworldwide commentedon Jan 18, 2017
Also, I've recently come up with a similar edge case. Sometimes I need to delete all data by FK. I.e. delete all orders belong to user X. I think the remove() api only allows for the removal of a single record atm. Would be nice to have the orm take care of this too.
pleerock commentedon Jan 20, 2017
but thats not safe and can bring lot of issues on production....
pleerock commentedon Jan 26, 2017
will be released in
@nextvery soon...dcworldwide commentedon Jan 31, 2017
Great, thanks!