简体   繁体   中英

set_relation_n_n with "Not in" in grocery Crud

I have one relation n to n, and it's working fine but I need filter with not in . please see the code below

$crud ->set_relation_n_n('Productos', 'donaciones_productos', 'productos', 'donaciones_id', 'productos_id', '{nombre}({serie})','id',array('id_estado'=>5,'activo'=>1));

but i need include other filter with sentence "not in" . Some similar to

$this->db->where ('productos.id not in (select productos_id from donaciones_productos)');

I hope you can help me, and thanks for your time and help

Thanks in advance

For me when I get into this kind of problem, the best solution is to turn to the "views",

You can create view with the exact result you expect and set_primary_key in grocery crud that will deal with the view like a table but you need to customize the update and insert call backs to affect original tables,

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM