0
I持って、次のデータベーステーブル:以下のモデル協会とCakePHPの収容可能挙動は期待通りに動作していない
products
********
id
title
artist_id
artists
*******
id
profile
rating
person_id
people
******
id
full_name
:私は収容可能動作を使用するために、3つのモデルのそれぞれを設定している
Product Model
*************
public $belongsTo = array(
'Artist' => array(
'className' => 'Artist'
'foreignKey' => 'artist_id'
)
);
Artist Model
************
public $belongsTo = array(
'Person' => array(
'className' => 'Person'
'foreignKey' => 'person_id'
)
);
public $hasMany = array(
'Product' => array(
'className' => 'Product'
'foreignKey' => 'product_id'
)
);
Person Model
************
public $hasOne = array(
'Artist' => array(
'className' => 'Artist'
'foreignKey' => 'person_id'
)
);
を使用して:
public $actsAs = array('Containable');
私は次のものを使用して、アートイストの名前:
$this->Product->find('first', array('conditions' => array('Product.id' => $id), 'contain' => 'Person.full_name'))
私は警告を取得:
Model "Product" is not associated with model "Person"
をそして、私は唯一の製品の詳細情報はありませんアーティストの名前、すなわちます。なぜこうなった?