Search code examples
phpactiverecordfilteryiicgridview

adding extra property ActiveRecord for enabling custom filter column in CgridView


I have a gridView in my program which it's data are populated with my ActiveRecord model.according to this answer I added some extra properties in my ActiveRecord to enable adding extra filtering column.
My queston is that is this a right way for doing such things.I mean adding some property which can not be matched with database table fields.
If not whcih approaches can be used in these scenarios?


Solution

  • There's nothing bad with adding a property that doesn't match a database field. It's widely used approach and you can rely on it. Here's an example from yii wiki.