Grails: How to combine domain objects' errors with command objects' errors?

前端 未结 3 783
日久生厌
日久生厌 2021-02-05 17:06

Suppose I have User domain class and RegistrationCommand class. So when user is registering on website there are two steps for data validation:

  1. RegistrationCommand
3条回答
  •  青春惊慌失措
    2021-02-05 17:41

    I did the following for my project and found it to be more cleaner!

    domain.errors.each {
      cmdObject.errors.reject(it.code, g.message(error: it))
    } 
    

提交回复
热议问题