having a problem here. So i have two tables, ‘Groups’ and ‘User’ and a ‘through’ table ‘GroupsMembers’ and what i need to do is limit the columns that i get. Mostly because i don’t need them and Users have another table (grades) associated which also has columns irrelevants to me.
I can limit the columns for Users with a finder but not for the ‘throughs’ tables (GroupsMembers and Grades). Any ideas? is it possible?
> //GroupsController code
>
> $mdlGroup = $this->MdlGroups->get($id, [
> 'contain' => ['MdlCourse', 'MdlUser' => ['finder' => 'limitRows'], 'MdlUser.MdlGradeItems'],
> 'finder' => 'limitRows',
> ]);
>
> //GroupsTable code
> $this->belongsToMany('MdlUser', [
> 'joinTable' => 'MdlUser',
> 'through' => 'MdlGroupsMembers',
> 'foreignKey' => 'groupid',
> 'targetForeignKey' => 'userid',
> ]);
>
> //GroupsMembers code
> $this->belongsTo('MdlUser', [
> 'foreignKey' => 'userid',
> 'joinType' => 'INNER',
> ]);
> $this->belongsTo('MdlGroups', [
> 'foreignKey' => 'groupid',
> 'joinType' => 'INNER'
> ]);
>
> //UserTable code
> $this->belongsToMany('MdlGroups', [
> 'joinTable' => 'MdlGroups',
> 'through' => 'MdlGroupsMembers',
> 'foreignKey' => 'userid',
> 'targetForeignKey' => 'groupid',
> ]);
> $this->belongsToMany('MdlGradeItems', [
> 'joinTable' => 'MdlGradeItems',
> 'through' => 'MdlGradeGrades',
> 'foreignKey' => 'userid',
> 'targetForeignKey' => 'itemid',
> ]);