Tuesday, September 30, 2008

Re: Wrong i18n query

Without posting the CakePHP code you used to generate your query,
there is little anyone can offer to help. Hopefully, however, you've
gotten this straightened out by now.

On Sep 24, 12:21 pm, davidhc <davi...@gmail.com> wrote:
> Hi at all!
> I'm using i18n and i'm trying to search results with a form. But
> cakephp creates a wrong query. I get the error below:
> SQL Error: 1054: Unknown column 'Category.names' in 'where clause'
>
> The query is:
> SELECT `Category`.*, `I18n__name`.`content`, `Category`.`id` FROM
> `categorys` AS `Category` LEFT JOIN `i18n` AS `I18n__name` ON
> (`Category`.`id` = `I18n__name`.`foreign_key` AND `I18n__name`.`model`
> = 'Category' AND `I18n__name`.`field` = 'name') WHERE
> `Category`.`names` LIKE '%AAA%' AND `I18n__name`.`locale` = 'en';
>
> But it should be:
> SELECT `Category`.*, `I18n__name`.`content`, `Category`.`id` FROM
> `categorys` AS `Category` LEFT JOIN `i18n` AS `I18n__name` ON
> (`Category`.`id` = `I18n__name`.`foreign_key` AND `I18n__name`.`model`
> = 'Category' AND `I18n__name`.`field` = 'name') WHERE
> `I18n__name`.`content` LIKE '%AAA%' AND `I18n__name`.`locale` = 'en'
>
> Note that the table name and the field name are wrong!
>
> I think cakephp should create a wright query...
>
> I hope you can help me...
> Thank you very much!!!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: