Two Languages belongs to Lset, Lset HABTM Translator
It is defined as follows: Translator:
var $hasAndBelongsToMany = array(
'Lset' => array(
'className' => 'Lset',
'joinTable' => 'lsets_translators',
'foreignKey' => 'translator_id',
'associationForeignKey' => 'lset_id',
)
);
Lset:
var $belongsTo = array(
'langfrom' => array(
'className' => 'Language',
'foreignKey' => 'from_id',
),
'langto' => array(
'className' => 'Language',
'foreignKey' => 'to_id',
)
);
The thing i am doing is :
$this->paginate['Translator']['contain'] = array('Lset' =>array('langfrom', 'langto'));
debug($this->paginate());
In my opinion I should get Translator with Lsets, each of them with associated Language, but i开发者_JAVA技巧 only get an error:
SQL Error: 1054: Unknown column 'Lset.langfrom' in 'field list'
How should I do this ?
okay, found that. assosciants should be named with capital letter.
精彩评论