Setting a private field in massive assignment.

I’ve got a private field $hired that I include in my CGridView. Once I fill in the filter and send it back I want massive assignment to work with $hired, so I’ve made it a safe field in my model, but it doesn’t get set. I tried adding a setHired() function but it doesn’t get called. What’s the correct way to do this?

And FYI, I need the value to be private to prevent lazy loading of the relation that I need to determine $hired. I don’t always need $hired, and would like to save the queries.

If you have a relation with the same name “hired”, then a value will be always assigned to this relation instead of the private field. Choose another name or try to change the setter’s name (to “setIsHired” for example).

The relation is not named the same. The relation is jobCount, and then the hired field is set based on whether they have more than one valid job in the system.