CodeIgniter-MY_Model
CodeIgniter-MY_Model copied to clipboard
Getting soft deleted rows by get_relate functionality of many to many relationship
I've got the following three models:
users
$this->table = 'users';
$this->primary_key = 'id';
$this->soft_deletes = true;
groups_users
$this->table = 'groups_users';
$this->primary_key = 'uid';
$this->soft_deletes = true;
groups
$this->table = 'groups';
$this->primary_key = 'id';
$this->soft_deletes = true;
$this->has_many_pivot['users'] = array(
'foreign_model' => 'User_model',
'pivot_table' => 'groups_users',
'local_key' => 'id',
'pivot_local_key' => 'group_id',
'pivot_foreign_key' => 'user_id',
'foreign_key' => 'id',
'get_relate' => true,
);
With
$this->group_model
->with_users('fields:lastname,firstname,domain,alias')
->where('id', $id)
->get();
I get also the user data with soft deleted relationships of the pivot table groups_users.
At the moment I'm not sure if it is a bug or if I made a mistake. I'm grateful for any help.
Thanks in advance!
I'm having the same issue.