Question

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 only get an error:

SQL Error: 1054: Unknown column 'Lset.langfrom' in 'field list'

How should I do this ?

Was it helpful?

Solution

okay, found that. assosciants should be named with capital letter.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top