Changeset 720 for trunk/grails-app/domain
- Timestamp:
- Nov 25, 2010, 9:08:43 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/domain/InventoryItem.groovy
r719 r720 23 23 } 24 24 25 static hasMany = [alternateItems: InventoryItem, 26 spareFor: Asset, 25 static hasMany = [spareFor: Asset, 27 26 inventoryMovements: InventoryMovement, 28 27 alternateSuppliers: Supplier] … … 60 59 } 61 60 62 def afterInsert = {63 addReverseAlternateItems()64 }65 66 /**67 * Add reverse alternateItem references.68 */69 def addReverseAlternateItems() {70 this.alternateItems.each() {71 if( !it.alternateItems?.contains(this) )72 it.addToAlternateItems(this)73 }74 }75 76 /**77 * Remove all reverse alternateItem references.78 * On update: reverse alternateItem handling must be done in the79 * service class since the before assignment alternateItems are required.80 */81 def removeReverseAlternateItems(alternateItems = this.alternateItems) {82 alternateItems.each() {83 it.removeFromAlternateItems(this)84 }85 }86 87 61 }
Note: See TracChangeset
for help on using the changeset viewer.