CakePHP 3.6.14:表之间的外连接(使用连接表)

In my CakePHP application I have 3 tables (2 tables and 1 junction table):

task_types[id, name], task_type_groups[id, name], (junction table) task_types_task_types_group[id, task_type_id, task_types_group_id]

I want to populate a table in my view and filter it if the user selects a task_type_group.

So in the view I have this code for the filter and the table:

<div class="taskElements index large-9 medium-8 columns content">
    <div class="row">
        <?php echo $this->Form->create('AddTaskTypeToProject', array('action' => 'index')); ?>
        <?php echo $this->Form->control('task_type_groups', ['options' => $taskTypeGroups, 'empty' => true]); ?>
        <?php echo $this->Form->button(__('Filter'), ['class'=>'btn-success']); ?>
        <?php echo $this->Form->end(); ?>
    </div>

    <h3><?= __('Task Type Groups') ?></h3>
    <?php echo $this->Form->create('AddTaskTypeToProject', ['url'=>['action' => 'add']]); ?>
    <table cellpadding="0" cellspacing="0">
        <thead>
            <tr>
                <th scope="col"><?= $this->Paginator->sort('id') ?></th>
                <th scope="col"><?= $this->Paginator->sort('name') ?></th>
                <th scope="col"><?= $this->Paginator->sort('select') ?></th>
                <th scope="col"><?= $this->Paginator->sort('task_types_group_id') ?></th>
            </tr>
        </thead>
        <tbody>      
            <?php foreach ($taskTypes as $id => $taskType): ?>      
            <tr>
                <td><?= $this->Number->format($taskType->task_type->id) ?></td>
                <td><?= $taskType->task_type->name ?></td>
                <?= $this->Form->hidden("$id.id",['value' => $taskType->task_type->id]); ?>
                <?= $this->Form->hidden("$id.name",['value' => $taskType->task_type->name]); ?>
                <td><?= $this->Form->control("$id.checked", ['type' => 'checkbox']);?></td>
                <td><?= $taskType->task_types_group_id != 0 ? $this->Html->link($taskType->task_type_group->name, ['controller' => 'TaskTypeGroups', 'action' => 'view', $taskType->task_type_group->id]) : '' ?></td>

            </tr>
            <?php endforeach; ?>            
        </tbody>
    </table><?php
    echo $this->Form->submit('Add');
    echo $this->Form->end();?>
</div>

And in the controller:

public function index()
{        

    if($this->request->is('post'))
    { //filtering works as expected
       if($this->request->getData('task_type_groups') != null){
           $taskTypes = TableRegistry::get('TaskTypesTaskTypesGroups')
                            ->find('all', [
                                'conditions' => ['TaskTypesTaskTypesGroups.task_types_group_id' => $this->request->getData('task_type_groups')],
                                'contain' => ['TaskTypes', 'TaskTypeGroups']
                            ]);
       }
       else{ //this is not working
            $taskTypes = TableRegistry::get('TaskTypesTaskTypesGroups')
                            ->find('all', [
                                'contain' => ['TaskTypes', 'TaskTypeGroups']
                            ]);
       }

       $this->set(compact('taskTypes'));
    }
    else
    {
        $taskTypes = TableRegistry::get('TaskTypes')->find('all', [
                                'contain' => ['TaskTypesTaskTypesGroups']
                            ]);

        $this->set(compact('taskTypes'));
    }

    $taskTypeGroups = TableRegistry::get('TaskTypeGroups')->find('list');
    $this->set(compact('taskTypeGroups'));
}

If the user filters the table then it works and I get only the task_types that belong to the selected group. But if filter is empty then I don't get the task_types that are note associated to any group. So I want to convert this :

$taskTypes = TableRegistry::get('TaskTypesTaskTypesGroups')
                            ->find('all', [
                                'contain' => ['TaskTypes', 'TaskTypeGroups']
                            ]);

To an outer join which will return all task_types (no matter if they belong to a task_type_group or not)