CodeIgniter-MY_Model icon indicating copy to clipboard operation
CodeIgniter-MY_Model copied to clipboard

Getting soft deleted rows by get_relate functionality of many to many relationship

Open seicke opened this issue 9 years ago • 1 comments

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!

seicke avatar Jun 10 '16 12:06 seicke

I'm having the same issue.

johnnyhertogs2 avatar Mar 22 '17 13:03 johnnyhertogs2