⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

"where" in the relation(middle) table in relation_n_n



David Leiva
  • profile picture
  • Member

Posted 26 September 2012 - 11:33 AM

Hello all,

I've really read a lot of post about the relation_n_n but it is really driving me crazy.
I need to filter the relation_n_n results depending of a field in the middle table.

try to explain the situation with a example:
1.- table shoops
1.- table employees.
1.- table shops_has_employeed (because 1 employee can work in more than one shop.)

So i need all the shops for the one employee.... i mean.. i only want to see the shops for that employee..

Te problem is that doing the relation_n_n i can't have a "where" clause with id_employee in the middel table .. i only can use where with the main table fields..

I have read that i need override the grocery crud model, I have tried as well... but the method.. get_relation_n_n_unselected_array is never called.. i have the control in the "relation_n_n_queries"

Please help.. i supouse it cant be very dificult but i dont really know what is the proper solution... or what i'm doing wrong..

Thanks in advance...