0

在模型定义中

    $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'));

但吸气剂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 效果很好

4

1 回答 1

0

问题已解决

foreignAlias:in relationsforPhoto并且Preview必须不同

谢谢

于 2012-06-08T09:28:46.183 回答