index option in AR doesn't work

Hey, guys, I’m using Yii 1.0.9 and trying to get some additional attributes from a join table:

    //this is in my Promotion model


public function relations()


{


       return array(


	'users'   => array(self::MANY_MANY, 'User', 'Promotion_User(promotionId, userId)'),


            'winners' => array(self::MANY_MANY, 'User', 'Promotion_Winner(promotionId, userId)'),


            'winnersData' => array(self::HAS_MANY,'Promotion_Winner','promotionId',array('index'=>'userId')),


	);


}

Just inserting the index option in winnersData relation results in error when trying to execute the list action:

The property "CHasManyRelation.0" is not defined.

I have to do this because in Promotion_Winner I have some attributes like Timestamp, who delivered the gift, and so …

Does anybody have an idea on how to solve this?

Thank you very much!

You don’t need another array to specify ‘index’ option.

Thank you very much, Qiang, it works like a charm now:

public function relations()


{


	return array(


		'users'   => array(self::MANY_MANY, 'User', 'Promotion_User(promotionId, userId)'),


        'winners' => array(self::MANY_MANY, 'User', 'Promotion_Winner(promotionId, userId)'),


        'winnersData' => array(self::HAS_MANY,'Promotion_Winner','promotionId'[b],'index'=>'userId'),[/b]


	);


}

<?php echo CHtml::encode(Yii::app()->dateFormatter->formatDateTime($model->winnersData[$winner->userId]->promotionWinnerRaffleDate,‘medium’,’’)); ?>

cheers!!

:D