Yii Many To Many Relations

i have 3 data table

agents

CREATE TABLE IF NOT EXISTS agents (

agentId varchar(10) NOT NULL,

position varchar(20) NOT NULL,

name varchar(255) NOT NULL,

PRIMARY KEY (agentId)

) ;

propertydetail

CREATE TABLE IF NOT EXISTS propertydetail (

propertyDetailId int(11) NOT NULL AUTO_INCREMENT,

propertyTypeId int(11) NOT NULL,

propertyMethodId int(11) NOT NULL,

price int(11) NOT NULL,

PRIMARY KEY (propertyDetailId),

) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;

IMPORT one property have many agent & one agent have many property

above 2 table join by following table

agentpropertydetail

CREATE TABLE IF NOT EXISTS agentpropertydetail (

agentPropertyDetailId int(11) NOT NULL AUTO_INCREMENT,

agentId varchar(10) NOT NULL,

propertyDetailId int(11) NOT NULL,

PRIMARY KEY (agentPropertyDetailId),

KEY agentId (agentId,propertyDetailId),

KEY propertyDetailId (propertyDetailId)

) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=9 ;

i wrote following relation for propertydetail & agents model

propertydetail Model

return array(

	'agents' => array(self::MANY_MANY, 'Agents', 'agentpropertydetails(agentId, propertyDetailId)'),


	);

agents Model

return array(

‘propertydetail’ => array(self::MANY_MANY, ‘Propertydetail’, ‘agentpropertydetails(agentId, propertyDetailId)’),);

Agentpropertydetail model

return array(

		'agent' => array(self::HAS_MANY, 'Agents', 'agentId'),


		'propertyDetail' => array(self::HAS_MANY, 'Propertydetail', 'propertyDetailId'),


	);

i se tis code for View data from propertyDetail _view file

<?php echo CHtml::encode($model->agents->name); ?>

<?php echo CHtml::encode($model->agents->position); ?>

i was face following ERROR

[color="#FF0000"]The relation "agents" in active record class "Propertydetail" is not specified correctly: the join table "agentpropertydetails" given in the foreign key cannot be found in the database.[/color]

plz help for any solution thank you YII