Hi All,
Looking someones opinion on this who knows more than i do! My DB tables all have created_by and updated_by columns which FK’s to the user table. In Gridview i need to sort and filter based on the username, not the user id. I know how to do this using Search class ActiveDataProvider and creating relevant sort and FilterWhere conditions per class. What im wondering is there a way to do this across all my ActiveRecords/ActiveDataProviders rather than adding properties and updating each of the methods that return ActiveDataProvider. Possible options i see are (perhaps not all valid):
-
Extend ActiveDataProvider, add the sort and filterWheres and initialise the new class instead of ActiveDataProvider per ActiveRecord
-
Create a Behaviour, link it and call appropriate method in each ActiveRecord
-
Create a base class extending ActiveRecord, override/create methods to return already initialised ActiveDataProvider
-
Attach some sort of event/interceptor (if any exist) to update the result upon return (make believe land??)
Note im not saying any of these options wont work (apart from 4 possibly). Im just wondering if there is a better way to do this that im unaware of that doesn’t involve changing all my class implementations.
Many thanks
Ross