Non-configured delete field can delete all records
davidyell opened this issue · 6 comments
Setup
My setup is that I have boolean deleted
and datetime deleted_date
.
What I did
Added the Trait to my table and called hardDeleteAll()
.
What happened
All records in my table were deleted.
What I expected to happen
I would expect no records to be deleted, or an exception to be thrown if the default field doesn't exist in the Tables schema. Perhaps something like $entity->has($field)
If I get some time today, I'll see if I can submit a PR for this.
Indeed, that's an annoying behavior... Thanks for reporting it!
I like the idea of throwing an exception. I think it should be extended to all method and not only the hardDeleteAll()
one. Perhaps you could check if the soft delete field exists in getSoftDeleteField()
.
Yes, that's a good idea.
@davidyell are you still planning on submitting a PR, or do you want me to work on this?
Oh, so sorry I totally forgot. If you don't mind taking it on that would be
great. Thanks!
On Thu, 28 May 2015 18:02 Pierre notifications@github.com wrote:
@davidyell https://github.com/davidyell are you still planning on
submitting a PR, or do you want me to work on this?Reply to this email directly or view it on GitHub
#5 (comment)
.
No pb, i'll do it.