scala - Too many arguments for method mapping: (apply: (String, models.Address) => R)(unapply: R => Option[(String, models.Address)])play.api.data.Mapping[R] -
i have 2 case classes this.
case class company(name: string, address: address) case class address(address1: string, address2: string, city: string, state: string, zip:string, country: string)
in application.scala defined following.
[1]. val companyform = form(of(company.apply _, company.unapply _)( "name" -> text, "address" -> mapping( "address1" -> nonemptytext, "address2" -> text, "city" -> nonemptytext, "state" -> nonemptytext, "zip" -> nonemptytext, "country" -> nonemptytext )(address.apply)(address.unapply) ) ) [2]. val companyform = form(mapping( "name" -> text, "address" -> mapping( "address1" -> nonemptytext, "address2" -> text, "city" -> nonemptytext, "state" -> nonemptytext, "zip" -> nonemptytext, "country" -> nonemptytext )(address.apply)(address.unapply) )(company.apply, company.unapply) )
right [1] works me when try convert [2] gives me following error:
too many arguments method mapping: (apply: (string, models.address) => r)(unapply: r => option[(string, models.address)])play.api.data.mapping[r].
please suggest me doing wrong. in advance.
as methode of()
depricated, form must this:
val companyform = form( mapping( "name" -> text, "address" -> mapping( "address1" -> nonemptytext, "address2" -> text, "city" -> nonemptytext, "state" -> nonemptytext, "zip" -> nonemptytext, "country" -> nonemptytext )(address.apply)(address.unapply) )(company.apply)(company.unapply) )
so problem in syntax bellow company.apply , company.unapply
methods
Comments
Post a Comment