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.
adding extra property ActiveRecord for enabling custom filter column in CgridView
-
14-01-2022 - |
Question
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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow