我在网上搜索了 1000000000000000 次,但我找不到一个干净的解决方案
这是我的 CertificateType 模型翻译部分:
public $actsAs = array('Translate'=>array('title','description')) ;
和证书模型:
public $actsAs=array('Translate'=>array('filename')) ;
public $belongsTo = array(
'CertificateType' => array(
'className' => 'CertificateType',
'foreignKey' => 'certificate_type_id',
'conditions' => '',
'fields' => '',
'order' => ''
) ,
);
但是在获取时,所属模型不会翻译:
public function admin_index() {
$this->Certificate->locale = $this->Session->read('Config.language');
$this->Certificate->CertificateType->locale = $this->Session->read('Config.language');
$this->Certificate->recursive = 0;
$this->set('certificates', $this->paginate());
debug($this->Certificate->paginate()) ;
}
为什么?