I have $hasAndBelongsToMany relation between projects and documents and they are linked with associative table projects_documents(id, project_id,document_id). Something likes that
class Projects extends AppModel {
var $name = 'Projects';
var $hasAndBelongsToMany = array(
'Documents' => array(
'className' => 'Documents',
'joinTable' => 'projects_documents',
'foreignKey' => 'project_id',
'associationForeignKey' => 'document_id',
),
);
It is working perfectly when updates and inserts are required. I’m required to add a flag field of each document of project. So I added a field in projects_documents, now table structure is id, project_id,document_id and flag. I know associated table updates by cake native function, that’s why it updates project_id and document_id by itself.
My question is how I can update the newly added field flag for each write operation. I’ve tried with manual queries but I want to implement this according to cake standards.
Thanks