phpcr/phpcr-shell

Check for references when deleting nodes .. ? ..

dantleech opened this issue · 3 comments

We can then not attempt to persist them and fail on session save.

dbu commented

makes sense. i see this feature as a last resort, like sql foreign keys. they prevent data inconsistency, but the application (e.g. the shell) should check itself and provide more helpful information.

we might even ask the user whether he wants to delete those nodes (though those again might be referenced and so on). doing a force delete recursive cascade sounds like an excellent way to ditch half of your database. the other option would be to delete just the referencing property value, but whether that is a good idea depends on the data model...

regarding user not deleting their entire content tree by accident, I think it would be good to be able to review the changes before comitting a save. Either by wrapping the API session or by using the Jackalope feature if available.

e.g.

PHPCRSH> save
[ 1234 nodes will be affected, do you want to (y) continue, (n) stop, or (r) review ]
n

(related to #71)

Will be fixed by #110