Hi,

I have a problem to get the translation of a column using I18n doctrine
behavior.

My yaml schema is :

ubRoom:
  actAs:
    I18N:
      fields: [label]
      className: %CLASS%I18n
  columns:
    id: { type:integer(2), primary:true, autoincrement: true }
    country_iso: { type:string(2), notnull:true }
    room_type: { type:string(2), notnull:true }
    label: { type:string(32), notnull:true }
  relations:
    ubCountry: { onDelete: CASCADE, local: country_iso, foreign: iso }

When I run the request without specify the current culture, I can't get any
data with a ->getLabel() ou ->label

[...]
 $q = $this->createQuery('r')
              ->where('r.room_type = ?')
              ->andWhere('r.country_iso = ?');
[...]
->getLabel => print nothing
->label => print nothing

If I specify the culture in the DQL, I can use
->Translation[$culture]->label to get the localized value of the column.

[...]
 $q = $this->createQuery('r')
              ->leftJoin('r.Translation t')
              ->where('r.room_type = ?')
              ->andWhere('r.country_iso = ?')
              ->andWhere('t.lang = ?');
[...]
->Translation[$culture]->label => print the correct value of the localized
"label" column.


I don't understand why the first case isn't working. Someone can help me ?

Thank you,
Fabien

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to