Example of using the mjoinMinCount validation
Example of using the mjoinMinCount validation
dermes
Posts: 3Questions: 1Answers: 0
Hi!
I'm struggling to understand how to use the new Validate:mjoinMinCount() validation. Reading the manual this was my best guess of how to use it but this does not validate:
->join(
Mjoin::inst( 'genres' )
->validator('genres[].id', Validate::mjoinMinCount(1))
->link( 'contacts.id', 'contacts_genres.contact_id' )
->link( 'genres.id', 'contacts_genres.genre_id' )
->order( 'genres.genre asc' )
->fields(
Field::inst( 'id' )
->validator(Validate::required())
->options( Options::inst()
->table( 'genres' )
->value( 'id' )
->label( 'genre' )
),
Field::inst( 'genre' )
)
)
Could you point me in the right direction?
Thanks!
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
That looks correct. Are you using the Editor 1.9.0 PHP libraries?
Allan
Yes I'm using 1.9.0. On the 1.8 version i got an fatal error because of the missing methods.
I get a list of other validations from the ajax response so i guess it's somewhere in the backend PHP code that something is incorrect.
Example
I'm up to speed now! I've committed the fix for this. I think I got myself slightly out of sync.
You can use that change locally in 1.9.0 to get it running until we tag 1.9.1.
Regards,
Allan
Great, thanks allan!