0

プロジェクトとユーザーの2つのモデルを取得しました。プロジェクト内:

public function relations()
{
    // NOTE: you may need to adjust the relation name and the related
    // class name for the relations automatically generated below.
    return array(
            "users"=>array(self::MANY_MANY, 'User',
            'projects_users(project_id, user_id)'),
    );
}

実際のプロジェクトにいるすべてのユーザーをリストしたいのですが、 $model には実際のプロジェクトが含まれています:

    <?php $this->widget('zii.widgets.grid.CGridView', array(
    'id'=>'user-grid',
    'dataProvider'=>$model->users,
    'columns'=>array(
        'ID',
        'username',
        'displayname',
        'firstname',
        'lastname',
        'email',
        /*
        'password',
        'isAdmin',
        */

        array(
            'class'=>'CButtonColumn',
            'template'=>'{delete}',
        ),
    ),
)); ?>

残念ながら、エラーが発生します:

Fatal error: Call to a member function getData() on a non-object in /var/www/vhosts/aevers.com/editor/framework/zii/widgets/CBaseListView.php on line 107
4

2 に答える 2