我有一个域类
class Store{
String name
Store hierarchy
Date dateCreated
Date lastUpdated
static hasMany=[storeRestrictions:StoreRestrictions]
boolean isBillable
boolean isConsignment
boolean isMassUploadPossible
static constraints = {
name(nullable:false,blank:false,maxSize:50,unique:true)
hierarchy(nullable:true,blank:true)
dateCreated()
lastUpdated()
isBillable()
isMassUploadPossible()
storeRestrictions(nullable:false)
}
}
有什么方法可以更改 and 中的验证beforeInsert
,beforeUpdate
例如,如果isConsignment
为 true 那么storeRestrictions
可以变为nullable:true
?