Some associated data is not coming through, although it's in the contain
clause.
I can get $project->Participants
if I set a belongsToMany
relationship in the Projects
table, relating to Participants
through ProjectParticipants
, but that way I still can't reach other tables associated with ProjectParticipants
even with $project->participants->_joinData->other_related_table
How would I do to get ProjectParticipants
and Participants
with the same query?
Code:
// Database: Projects <--1:N-- ProjectParticipants --M:1--> Participants // ProjectController: $project = $this->Projects->get($id, ['contain'=>[ 'ProjectParticipants.Participants']); // ProjectsTable: $this->hasMany('ProjectParticipants', [ 'foreignKey' => 'project_id']); // ProjectParticipantsTable: $this->belongsTo('Participants', [ 'foreignKey' => 'participant_id']);
Thanks!
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment