Play! error of overloaded mapping of method values ​​to alternatives?

Defining the shape in my game! the controller, when the compiler spit out this strange mistake overloaded method value mapping with alternative:...[a bunch of crap]...Error occurred in an application involving default arguments

.

Here is the code, I'm not really sure what the cause might be:

 val jobForm: Form[Job] = Form(
    mapping(
      "id" -> of[Long],
      "end_time" -> text(minLength = 3),
      "start_time" -> text(minLength = 3),
      "client_id" -> of[Long],
      "start_address_type" -> text,
      "start_address" -> text(minLength = 3),
      "start_city" -> text(minLength = 3),
      "start_province" -> text(minLength = 2),
      "start_lat" -> optional(text),
      "start_lng" -> optional(text),
      "comments" -> text,
      "created" -> text,
      "modified" -> text,
      "canceled" -> of[Boolean],
      "started" -> of[Boolean],
      "completed" -> of[Boolean],
      "user_id" -> optional(of[Long]),
      "start_order" -> optional(number),
      "end_order" -> optional(number),
      "account_id" -> of[Long]
    )(Job.apply)(Job.unapply)
  )

      

+3


source to share


1 answer


Looked at the game! 2.0. It looks like you may only have 18 max arguments per mapping()

, so I had to start nesting and create new case classes. Here's the result:



val jobForm: Form[JobSimple] = Form(
    mapping(
      "id" -> of[Long],
      "end_time" -> text(minLength = 3),
      "start_time" -> text(minLength = 3),
      "client_id" -> of[Long],
      "location" -> mapping(
        "start_address_type" -> text,
        "start_address" -> text(minLength = 3),
        "start_city" -> text(minLength = 3),
        "start_province" -> text(minLength = 2),
        "start_lat" -> optional(text),
        "start_lng" -> optional(text)
        )(JobLocation.apply)(JobLocation.unapply),
      "comments" -> text,
      "created" -> text,
      "modified" -> text,
      "canceled" -> of[Boolean],
      "started" -> of[Boolean],
      "completed" -> of[Boolean],
      "user_id" -> optional(of[Long]),
      "start_order" -> optional(number),
      "account_id" -> of[Long]
    )(JobSimple.apply)(JobSimple.unapply)
  )

      

+4


source







All Articles