I am codding multiuser application.And in each model I have a field user_id, every user login and i can get him id: Yii::app()->user->id.
I don’t want to repeat it in every action find/update/inset condition so How can I set this in model user_id?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Use a CActiveRecordBehavior. That way you can hook the beforeFind/afterFind and beforeSave/afterSave events for all of your models. It’s really quite nice