On Mon, Aug 3, 2009 at 4:17 AM, Ed Leafe<[email protected]> wrote: > On Aug 2, 2009, at 9:24 PM, Miguel Lopes wrote: > >> I have a situation where when a record is deleted if its parent has no >> other child records it should also be deleted, and either both deletes >> are successful or should be discarded. > > If you mean that you want to delete a parent that no longer has any > children, you could do this in the child's afterDelete() method. > Create a method in the parent that scans self.__children to see if any > child has records, and if not, have the parent delete itself, and then > call that method from the afterDelete() of each of the children. >
That's the approach I took. But I looking at the code it seems that afterDelete() is not encapsulated in the transaction. So I potentially could endup with childless parents. Miguel _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users Searchable Archives: http://leafe.com/archives/search/dabo-users This message: http://leafe.com/archives/byMID/[email protected]
