Hi to all,
currently setDependentRelation does not allow you to set two dependent relations with the same table (the filter table).
In the exlample below two different tables (shops and price_lists), related to orders table, in their respective dependent relations shares the same filter table (retailers, obviously also related with orders table). But only last setted dependent relationship works correctly.
@web-johnny can you solve this problem in one of the next releases, please? I think the case shown in the example below is very common so this functionality would be useful to many.
Database tables for this example:
Table "orders"
-------------------
pk_order
fk_order_retailer
fk_order_shop
fk_order_price_list
...
Table "retailers"
-------------------
pk_retailer
retailer_name
...
Table "shops"
-------------------
pk_shop
fk_shop_retailer
shop_name
...
Table "price_lists"
-------------------
pk_price_list
fk_price_list_retailer
price_list_name
...
Code in orders controller:
... $crud->setRelation('fk_order_retailer', 'retailers', 'retailer_name'); $crud->setRelation('fk_order_shop', 'shops', 'shop_name'); $crud->setRelation('fk_order_price_list', 'price_lists', 'price_list_name'); $crud->setDependentRelation('fk_order_shop', 'fk_order_retailer', 'fk_shop_retailer'); // this currently doesn't work $crud->setDependentRelation('fk_order_price_list', 'fk_order_retailer', 'fk_price_list_retailer'); ...
Until the setDependentRelation function is upgraded as required, can someone suggest a work around to get the same result?