-
Notifications
You must be signed in to change notification settings - Fork 144
Open
Description
I’m using friendsofcake/crud I have a pivot table EnquiryContacts which joins Enquiries, Roles and People tables. The EnquiriesTable has a belongsToMany association:
$this->belongsToMany('Clients', ['through' => 'EnquiryContacts', 'className' => 'People', 'conditions' => ['role_id' => 3], 'foreignKey' => 'enquiry_id', 'targetForeignKey' => 'person_id']);
And the PeopleTable has the reverse association:
$this->belongsToMany('ClientEnquiries', ['through' => 'EnquiryContacts', 'className' => 'Enquiries', 'conditions' => ['role_id' => 3], 'foreignKey' => 'person_id', 'targetForeignKey' => 'enquiry_id']);
But results returned by IndexAction will include records with any role_id, instead of just those within the conditions.
Is this expected behaviour or a bug? If expected, how should I go about ensuring a response that takes the conditions of the association into account?
Metadata
Metadata
Assignees
Labels
No labels