Hi
I have a model where an entity belongsto and belongsToMany users:
$this->belongsTo('Users', [
'foreignKey' => 'user_id',
'joinType' => 'INNER',
'propertyName' => 'utilisateur'
]);
$this->belongsToMany('Users', [
'foreignKey' => 'quete_id',
'targetForeignKey' => 'user_id',
'joinTable' => 'users_quetes',
'propertyName' => 'utilisateurs'
]);
I want to eager load the user and the users in pagination , so I do this :
$this->paginate[‘contain’] = [‘Users’];
but only the belongsToMany association is loaded. If I comment the belongsToMany association, I Got an entity in utilisateur var;
I have try $this->paginate[‘contain’] = [‘Users’,‘User’];
but it says that the association ‘User’ is not defined;
I have try $this->paginate[‘contain’] = [‘Users’,‘utilisateur’];
but it says that the association ‘utilisateur’ is not defined;
I guess the problems is because it is link to the same table
My question is how to eager load the both associations (users and user) in pagination