Example:
- Staff(relation_id(non primary key))
- Teacher(teacher_id(non primary key))
- Vendors(vendor_id(non primary key))
Now, teacher_id = relation_id for the relationship with the Teacher to Staff
vendor_id = relation_id for the relationship with the Vendors to Staff
In, Staff table I’m associating in Staff.php like below:
public $belongsTo = array(
'Teacher' => array(
'className' => 'Teacher',
'foreignKey' => false,
'conditions' => array('Teacher.is_deleted' => 0, '`Staff`.`relation_id` = `Teacher`.`teacher_id`'),
'fields' => '',
'order' => '',
'dependent' => false
),
'Vendor' => array(
'className' => 'Vendor',
'foreignKey' => false,
'conditions' => array('Vendor.is_deleted' => 0, '`Staff`.`relation_id` = `Vendor`.`vendor_id`'),
'fields' => '',
'order' => '',
'dependent' => false
),
);
But its not working, can anyone have idea in cakephp2?