Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

Massive Assignment Non-Database Column Fields In Model

$
0
0
I have a CActiveRecord model, Job which has a public property $completionChoice.

It doesn't relate to a databasefield, and I don't have getter or setter methods for it. I use it as a flag for some processing during beforeSave()

What I'd like to be able to do is massively assign from the form, so have $_POST['completionChoice'] automatically get assigned to it when I do $job->attributes() = $_POST['Job'], however I can't get it working.

I've tried setting $completionChoice as safe, and I've tried overriding CActiveRecord::attributeNames() to add it, but it doesn't get assigned.

How do I do this?

Thanks

Iain

Viewing all articles
Browse latest Browse all 18717

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>