Ignore:
Timestamp:
Feb 16, 2010, 10:02:34 AM (10 years ago)
Author:
gav
Message:

Configure cascade deletion of Site -> Section -> Asset -> SubItems.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/services/AssetService.groovy

    r352 r360  
    4747                    r = assetSubItemService.delete(id: assetSubItem.id)
    4848                    if(r.error) {
     49                        log.debug r.error
    4950                        fail(code:"asset.subItems.delete.failure")
    5051                        break
     
    5657                return result
    5758
    58             try {
    59                 result.assetInstance.delete(flush:true)
    60                 return result //Success.
    61             }
    62             catch(org.springframework.dao.DataIntegrityViolationException e) {
    63                 return fail(code:"default.delete.failure")
    64             }
     59            // Success.
     60            // We have handled all the foreign keys so the delete should go forward.
     61            // Can't flush here due to cascading from Section and Site.
     62            // And without flush there is no point it trying to catch the dao.DataIntegrityViolationException
     63            // since that will only happen after leaving the transaction.
     64            result.assetInstance.delete()
     65            return result
    6566
    6667        } // end withTransaction
Note: See TracChangeset for help on using the changeset viewer.