Ask, before delete (Best Practice)

Hi,

is there a best practice, to ask the user before deleting an item (domain model)?
I want to implement something like: "Do you really want to delete user “Klaus”? (Yes/Cancel)
Of course one can use some JS triggered by a click, making a little form visible, which contains the link to actionDelete() …

I think in FLOW there should be a simple elegant way to do so!

Sugestions?

There you have your answer already. This is a purely UI thing IMO.

TBH I would probably rather make deletes undoable than show Popups-of-Fear, at least if deleting happens more than once in a year.

If you are running the risk of deleting a project, where lots of people and lots of money are involved, I shurely want to have a warning.
We probably install a special user, with the licence to kill.

So, if I got you right, there is nothing prefabricated. I think a framework like flow should provide a solution for this “standard problem”.

To make a detele undoable sounds intersting to me. Do you know where to look for details?

Thanks for your thoughts, Alexander.

Have a nice WE
Klaus

I think a framework like flow should provide a solution for this “standard problem”.

I’m not so sure about that, because this can be implemented in very different ways depending on the application. Doing a client side popup is just one of dozens ways and providing a opinionated solution in that case is IMO counter-productive (apart from Flow not providing any client-side solutions anyway).

To make a detele undoable sounds intersting to me. Do you know where to look for details?

If you want anything usable out-of-the-box, take a look at the Gedmo Doctrine extensions:

But be aware though, that soft-delete has it’s drawbacks:
http://jameshalsall.co.uk/posts/why-soft-deletes-are-evil-and-what-to-do-instead

The suggested solution to use an AuditLog is probably the best solution to have recoverable deletes in your application, but it’s also a bit more complex to implement. You could also use a Gedmo extension for this, which basically versions your entity and keeps a history of it in a separate table:

The bonus with this is, that you can not only undo deletes, but basically undo any change done on the entity.

I hope that helps!

1 Like

Thanks,
I will think about that.