Showing attributes of another model in CGridView in Yii?

A simple way to access related model fields in yii is to use something like this $model->relatedModel->field -- this can be used if there is a has_one or belongs_to relation between the models. So in your case, you can access the group name of a member using the code $memberModel->group->name But when you need to access related model fields for has_many or many_many relation types, you will need to do something like $model->relatedModelarrayIndex->field This is because there are many related models in this case, and yii automatically gives you the related model in an array. In your case a group has many members and to access a particular member(say the first member, i.

E arrayIndex = 0 ) of a group you can use $groupModel->members0->firstname Now to coming to your exact question, first of all, you do not need to declare or initialize or pass the $member model. So your controller action can be.

I had the Similar question and I have solved this question. Here you may find the answer.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions