$this->hasMany('Photo', array(
'refClass' => 'StyleLangHasPhoto',
'local' => 'style_lang_id',
'foreign' => 'photo_id'));
$this->hasMany('Photo as Preview', array(
'refClass' => 'StyleLangHasPreviewPhoto',
'local' => 'style_lang_id',
'foreign' => 'photo_id'));
但是getter getPreview
甚至$this->_get('Preview')
会引发Unknown record property / related component "Preview" on "StyleLang"
我试着这样做
$this->hasMany('Photo as Slide', array(
'refClass' => 'StyleLangHasPhoto',
'local' => 'style_lang_id',
'foreign' => 'photo_id'));
$this->hasMany('Photo as Preview', array(
'refClass' => 'StyleLangHasPreviewPhoto',
'local' => 'style_lang_id',
'foreign' => 'photo_id'));
但没有任何改变
我做错了什么?
UDP1: getPhoto,setPhoto,setPreview效果不错
答案 0 :(得分:0)
问题解决了
foreignAlias:
relations
和Photo
中{p> Preview
必须不同
感谢名单