views:

29

answers:

1

I'm using Symfony for the first time, and on a project requiring the front end in two languages (currently). Although the i18n features of the framework have been fairly simple to get up and running, I'm hitting a problem with the website admin section. Here is a sample of the generator.xml for the 'Page' object:

config:
  actions: ~
  fields:  ~
  list:
    title: Content Pages
    max_per_page: 15
    display: [=title, slug]
    fields:
      title: { label: "Title" }
      slug: { label: "Slug" }
    sort: [title]

The 'title' field is a translatable field in the database, so when I add more than one Page, and go to the list view I get this error:

 column "title" does not exist
 Failing Query: "SELECT p.id AS p__id, p.page_id AS p__page_id, p.enabled AS p__enabled, p.position AS p__position, p.created_at AS p__created_at, p.updated_at AS p__updated_at FROM page p ORDER BY title asc LIMIT 15"

Which is understandable, in that the system is clearly trying to query against the non-translated table. However, if I change the generator.xml to have sort: [created_at], the error above still appears.

Interestingly, if I update the max_per_page, that change is reflected in the query ("..LIMIT 14" for example), so clearly at least some of the file is being parsed correctly.

I've cleared my cache and regenerated the database, but am stumped as to why this is happening.

Any ideas?

A: 

I've finally found a solution to this problem, and it's an interesting one. Symfony stores the sort order in session cookies, and so although I was updating the generator.yml file (and clearing the Symfony cache), my session variables were untouched. I got the solution from this Symfony-Users discussion from earlier in the year:

http://groups.google.com/group/symfony-users/browse_thread/thread/dd253b853ed50478/0750bee8b29f5427?#0750bee8b29f5427

Crucially, although the root cause of the problem was the session cookies, the fact that this meant a querying against the DB for a non-existent (translated) field caused the error.

I still don't know how to sort by the i18n fields, but at least I can view the list page again :->.

Sarcas