this is a follow-up of #116
the problem is: what happens when a ReferenceOne path or weak reference property points to something non-existing? is the property null? is the currently invalid reference removed on save or kept (which would make sense, in case the node at path appears later). but if it is usually kept, how can we delete it if we want?
I think, that the invalid reference should stay intact, but ODM should simply return null. (So basically the way it's handled in 1.0.1). If something is being deleted without proper cleanup, the chance is, that it's a bug/mistake. In that way, when WeakReferences are preserved, mistakenly deleted nodes can be restored from backup (eg. by Toromiro or other JCR tool) and previously broken references will be valid again.
The other thing to consider - is it possible to do some sort of optional cleanup, when deleting a node? Eg. I want to delete a node with image file, so ODM provides a simple way to null out all refering fields..
Yes, I'm using ODM 1.0.1 and if I remove a node, which is referenced by another node, ODM (or Jackalope - I'm not sure on what level it's being done) returns null, but the reference field in JCR (I'm using Jackrabbit) is intact. Considering that's a pretty important thing, it should be heavily tested, both with Jackrabbit and DBAL implementation. I can't guarantee that I'll be able to provide tests for this though (primarily due to the lack of free time:/ )...
thanks for the report. i will try to add some tests around this in the near future, so we at least know what works and what not.