views:

457

answers:

1

I am trying to get the translate behaviour working, i deleted the translated comlumns from the original table and now I am getting errors when performing the following query:

$menu = $this->Menu->find('first', array('conditions' => array('Menu.title' => 'main-nav')));

My Menu model:

<?php
class Menu extends AppModel {
    var $name = 'Menu';

    var $actsAs = array(
     'Translate' => array(
      'title', 'link_title', 'path'
     ),
     'Tree'
    );

    /*var $belongsTo = array('Content'); disabled for now.. */
}
?>

Here is the SQL/Error generated:

Warning (512): SQL Error: 1054: Unknown column 'Menu.title' in 'where clause' [CORE/cake/libs/model/datasources/dbo_source.php, line 525]

Query: SELECT `Menu`.*, `I18n__title`.`content`, `I18n__link_title`.`content`, `I18n__path`.`content` FROM `ags_menus` AS `Menu` LEFT JOIN `ags_i18n` AS `I18n__title` ON (`Menu`.`id` = `I18n__title`.`foreign_key` AND `I18n__title`.`model` = 'Menu' AND `I18n__title`.`field` = 'title') LEFT JOIN `ags_i18n` AS `I18n__link_title` ON (`Menu`.`id` = `I18n__link_title`.`foreign_key` AND `I18n__link_title`.`model` = 'Menu' AND `I18n__link_title`.`field` = 'link_title') LEFT JOIN `ags_i18n` AS `I18n__path` ON (`Menu`.`id` = `I18n__path`.`foreign_key` AND `I18n__path`.`model` = 'Menu' AND `I18n__path`.`field` = 'path') WHERE `Menu`.`title` = 'main-nav' AND `I18n__title`.`locale` = 'en_gb' AND `I18n__link_title`.`locale` = 'en_gb' AND `I18n__path`.`locale` = 'en_gb' LIMIT 1

Obviously Im getting the error because the column no longer exists in the Menu model/table, but I assumed the translate behavior automagically took care of this?

A: 

I managed to find a solution:

'conditions' => array('I18n__title.content' => 'main-nav')
Bren G.