maybe put in before find in B $this->B->behaviors->attach
('Translate'); its stupid solutions but maybe work..On 2 Lis, 16:43, Marco <[email protected]> wrote: > Had to add some facts: > > I removed AppModel's beforeFind and beforeSave (I forgot to write > Config.language, which is used by Translate Behavior). So forget about > these lines. > Another important thing is, that field_a and field_b in my real world > app are named equal. But tested it also with different names. Same > result. > I actually don't really know, how should be responsible for replacing > field_a / field_b with I18n__field_a / I18n__field_b which comes from > Translate Behavior. And I'm also not sure, if Translate Behavior works > also for contained Models. > > Marco > > On 2 Nov., 16:22, Marco <[email protected]> wrote: > > > > > Hi guys, > > > i'm trying to combine Containable and Translate Behavior. > > > My setup: > > > Models: > > A hasMany B > > A Translate = 'field_a' > > B belongsTo A > > B Translate = 'field_b' > > > Controllers: > > A->contain('B'); > > A->read(null, $id); > > > AppModel: > > beforeFind: > > $this->locale = 'de_de'; > > beforeSave: > > $this->locale = 'de_de'; > > > So what I expected was translated content for associated datasets of B > > in reading A. But what automagically happens with field_a from > > instance A, doesn't appear with field_b from instance B. I checked the > > sql command. This seems to be correct. > > > SELECT B.*, I18n__field_b.content FROM b AS B LEFT JOIN i18n AS > > I18n__field_b ON (B.id = I18n__field_b.foreign_key AND > > I18n__name_field_b.model = B AND I18n__field_b.field = field_b) WHERE > > a_id = 1 AND I18n__field_b.locale = de_de > > > Any suggestions? I don't know how to use it together. Of course I can > > make the find call manually for B, but I wanted to use the normally > > really good Containable Behavior. > > > Thanks in advance. > > Marco -- You received this message because you are subscribed to the Google Groups "CakePHP" 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/cake-php?hl=.
