post by bgeneto on Nov 26, 2024

Are there any way to limit the setRelation to existing data only? I’ve noticed that when we use setRelation all the data from the related table is retrieved (and showed in the search combo filter, even if it is not present in the datagrid).

11 days later

post by johnny on Dec 8, 2024

Hello @bgeneto ,

Yes this is possible with the where parameter of setRelation. For example something like this (don’t forget the parenthesis):

$crud->setRelation('country', 'countries', 'nicename', '(c.iso IS NOT NULL)');
1 / 2
Nov 2024