PGBI / cakephp3-soft-delete

83 stars 60 forks source link

Non-configured delete field can delete all records #5

Closed davidyell closed 9 years ago

davidyell commented 9 years ago

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)

davidyell commented 9 years ago

If I get some time today, I'll see if I can submit a PR for this.

PGBI commented 9 years ago

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().

davidyell commented 9 years ago

Yes, that's a good idea.

PGBI commented 9 years ago

@davidyell are you still planning on submitting a PR, or do you want me to work on this?

davidyell commented 9 years ago

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 https://github.com/PGBI/cakephp3-soft-delete/issues/5#issuecomment-106491016 .

PGBI commented 9 years ago

No pb, i'll do it.