Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: tombujok/grails-core
...
head fork: tombujok/grails-core
Checking mergeability… Don’t worry, you can still create the pull request.
  • 1 commit
  • 1 file changed
  • 0 commit comments
  • 1 contributor
View
21 grails-web/src/main/groovy/org/codehaus/groovy/grails/web/binding/GrailsWebDataBinder.groovy
@@ -547,7 +547,26 @@ class GrailsWebDataBinder extends SimpleDataBinder {
}
}
}
- super.addElementToCollection obj, propName, propertyType, elementToAdd, clearCollection
+ boolean isSet = false
+
+ def domainClass = (GrailsDomainClass)grailsApplication.getArtefact(DomainClassArtefactHandler.TYPE, obj.getClass().name)
+ if (domainClass != null) {
+ def property = domainClass.getPersistentProperty propName
+ if (property != null) {
+ if (property.isOneToMany() || property.isManyToMany()) {
+ def methodName = 'addTo' + GrailsNameUtils.getClassName(property.name)
+ if(GrailsMetaClassUtils.invokeMethodIfExists(obj, methodName, [elementToAdd] as Object[])) {
+ isSet = true
+ }
+ }
+ }
+ }
+
+
+ if(!isSet) {
+ isSet = super.addElementToCollection obj, propName, propertyType, elementToAdd, clearCollection
+ }
+ isSet
}
protected addElementToCollection(obj, String propName, GrailsDomainClassProperty property, propertyValue, boolean clearCollection) {

No commit comments for this range

Something went wrong with that request. Please try again.