Dear Grails users,
Looking for advice :)
I am trying to accomplish this: Submit a form with text-field “subject” and text-area “content”, which (if validated) creates 1 new Ticket and 1 Article that belongs to the Ticket just created.
I think I need to create a Command Object w. the combined properties (for validation), but how do I persist the command object into Ticket and Article ?
Simplified, I have the following domains;
# Domain Class: Ticket
class Ticket {
String title // Should be set to the subject of 1st Article when saved
static hasMany = [ articles: Article ]
static constraints = {
title(maxSize: 128)
}
}
# Domain Class: Article
class Article {
String subject
String content
static belongsTo = [ ticket: Ticket ]
static constraints = {
subject()
content()
}
}
Help is greatly appreciated,
Mark