Wel fixed myself
Added callback in files model:

function afterSave($created){
     if ($created == false && !empty($this->data['Upload']['cat_id']))
{
         $this->locale = false;
         $count = $this->find('count',array('conditions'=>array
('Upload.cat_id'=>$this->data['Upload']['cat_id'])));
         $toSave['UploadCat']['id']           = $this->data['Upload']
['cat_id'];
         $toSave['UploadCat']['upload_count'] = $count;
         $this->UploadCat->save($toSave);
     }

}
And it is now working fine

On Jul 9, 11:18 am, Aurimas <[email protected]> wrote:
> Hello,
>
> Does counter cache working with translate behaviour? I have problems
> when i am updating record in diferent lang, for example, i have
> gallery where are 5 files counter cache then works fine, but when i
> try to change file lang, say translate to rus i get updated counter
> cache and now counter  is 1 as i have just one translated record in
> rus.
>
> //As you see it counts translations in I18n table. So count is 1 file.
> SELECT COUNT(DISTINCT(`Upload`.`id`)) AS count FROM `val_uploads` AS
> `Upload` INNER JOIN `val_i18n` AS `I18nModel` ON (`Upload`.`id` =
> `I18nModel`.`foreign_key` AND `I18nModel`.`model` = 'Upload' AND
> `I18nModel`.`locale` = 'rus') WHERE `Upload`.`cat_id` = 15
>
> //And here i get updated it to 1 as it should be 5
> UPDATE `val_upload_cats` AS `UploadCat` SET `UploadCat`.`upload_count`
> = 1 WHERE `UploadCat`.`id` = 15
>
> Does it should behave so? What solutions do you suggest?
--~--~---------~--~----~------------~-------~--~----~
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=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to