绑定模型到绑定模型?Cakephp
我使用bindModel方法将ProductsPhoto绑定到子级:绑定模型到绑定模型?Cakephp,cakephp,cakephp-1.3,Cakephp,Cakephp 1.3,我使用bindModel方法将ProductsPhoto绑定到子级: $this->Category->bindModel(array ('hasMany' => array( 'ProductsPhoto' => array... 如何将ProductsPhoto绑定到每个产品项 或者任何其他解决方案建议?正在进行中:$this->ProductsPhoto->bindModel('hasMany'=>'Pro
$this->Category->bindModel(array
('hasMany' => array(
'ProductsPhoto' => array...
如何将ProductsPhoto绑定到每个产品项
或者任何其他解决方案建议?正在进行中:
$this->ProductsPhoto->bindModel('hasMany'=>'Product')代码>
通过ProductsPhoto
class属性:$hasMany='Product'代码>动态:$this->ProductsPhoto->bindModel('hasMany'=>'Product')代码>
通过ProductsPhoto
class属性:$hasMany='Product'代码>在控制器中,编写以下代码
$this->ProductsPhoto->bindModel('hasMany' => array('Product.productphoto_id' => 'ProductPhoto.id');
在ProductPhoto模型中
var $hasMany = array(
'Product' =>
array(
'className' => 'ProductPhoto',
'foreignKey' => 'productphoto_id',
'conditions' => '',
'fields' => '',
'order' => '',
'counterCache' => ''
),
);
在控制器中,编写以下代码
$this->ProductsPhoto->bindModel('hasMany' => array('Product.productphoto_id' => 'ProductPhoto.id');
在ProductPhoto模型中
var $hasMany = array(
'Product' =>
array(
'className' => 'ProductPhoto',
'foreignKey' => 'productphoto_id',
'conditions' => '',
'fields' => '',
'order' => '',
'counterCache' => ''
),
);
$this->ProductsPhoto->bindModel()?$this->ProductsPhoto->bindModel()?