6.3.5.1 Using the bindTranslation method
You can also retrieve all translations, only when you need them, using the bindTranslation method
bindTranslation($fields, $reset)
$fields is a named-key array of field and association name, where the key is the translatable field and the value is the fake association name.
$this->Post->bindTranslation(array ('name' => 'nameTranslation'));
$this->Post->find('all', array ('recursive'=>1)); // need at least recursive 1 for this to work.
$this->Post->bindTranslation(array ('name' => 'nameTranslation'));$this->Post->find('all', array ('recursive'=>1)); // need at least recursive 1 for this to work.
With this setup the result of your find() should look something like this:
Array
(
[Post] => Array
(
[id] => 1
[name] => Beispiel Eintrag
[body] => lorem ipsum...
[locale] => de_de
)
[nameTranslation] => Array
(
[0] => Array
(
[id] => 1
[locale] => en_us
[model] => Post
[foreign_key] => 1
[field] => name
[content] => Example entry
)
[1] => Array
(
[id] => 2
[locale] => de_de
[model] => Post
[foreign_key] => 1
[field] => name
[content] => Beispiel Eintrag
)
)
)
Array([Post] => Array([id] => 1[name] => Beispiel Eintrag[body] => lorem ipsum...[locale] => de_de)[nameTranslation] => Array([0] => Array([id] => 1[locale] => en_us[model] => Post[foreign_key] => 1[field] => name[content] => Example entry)[1] => Array([id] => 2[locale] => de_de[model] => Post[foreign_key] => 1[field] => name[content] => Beispiel Eintrag)))


























