views:

35

answers:

1

Hi,

I'm having a problem getting the title of an object from my i18n object in Doctrine 1.1.6 / Symfony 1.2

I have the following Doctrine Table method:

public function getPlace($place_id, $lang=''){
$q = Doctrine::getTable('Place')
  ->createQuery('p');

if($lang != '')
  $q = $q->leftJoin('p.Translation ptr')
    ->addWhere('ptr.lang = ?', $lang);

return $q->addWhere('p.id = ?', $place_id)
    ->fetchOne();

}

Then on the view file if I do $place->getTitle(), it prints the title correctly in the language I wanted. However, if I do $place->getTitle() on an action it returns nothing, I have to do $place->Translation['es']->title to get the title in Spanish. If I work with the default language ('en') $place->getTitle() works.

Any idea on how to make $place->getTitle() to work always?

thanks!

A: 

I dind't find out why it doesn't work; so I now do $place->Translation[$lang]->title to get the title on the language I wanted.

fesja