Ok, so I have an Article model like this:
Article:
actAs:
I18n:
fields: [title, content]
actAs:
Sluggable:
fields: [title]
uniqueBy: [lang, title]
columns:
title: string(255)
date: date
content: clob
And I retrieve an article this way:
public function finOneBySlug($slug, $culture)
{
return Doctrine_Query::create()
->from('Article a')
->leftJoin('a.Translation tr WITH tr.lang = ?', $culture)
->addWhere('tr.slug = ?', $slug)
->fetchOne();
}
So far so good.
But I also use a language switcher...
And as my slug field is i18nd, if I switch languages I end up with a
nice 404,
since other languages slugs were not included in the result set.
And as the content field can contain quite a lot of text,
I don't want to load all the translations.
I thought I could lazy load the content field:
public function finOneBySlug($slug, $culture)
{
return Doctrine_Query::create()
->select(a.*, tr.slug, tr.lang)
->from('Article a')
->leftJoin('a.Translation tr WITH tr.lang = ?', $culture)
->addWhere('tr.slug = ?', $slug)
->fetchOne();
}
but it doesn't work...
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---