# CakePHP 3.x - save not work in associate table

**URL:** <https://discourse.cakephp.org/t/cakephp-3-x-save-not-work-in-associate-table/6316>\
**Category:** Need Help\
**Created:** [June 28, 2019, 6:42am UTC](https://discourse.cakephp.org/t/cakephp-3-x-save-not-work-in-associate-table/6316 "2019-06-28T06:42:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![durgesh](https://avatars.discourse-cdn.com/v4/letter/d/eb9ed0/32.png) [@durgesh](https://discourse.cakephp.org/u/durgesh)\
**Post date:** [June 28, 2019, 6:42am UTC](https://discourse.cakephp.org/t/cakephp-3-x-save-not-work-in-associate-table/6316/1 "2019-06-28T06:42:37Z")

</div>

I have below table structure.

Mandator table

```
class MandatorTable extends Table
{
public function initialize(array $config)
    {
        $this->table('mandators');

        $this->belongsToMany('Seminar', [
            'foreignKey' => 'mandator_id',
            'targetForeignKey' => 'seminar_id',
            'joinTable' => 'mandators_seminars'
        ]);
	}
}

```

Semiar table

```
class SeminarTable extends Table
{
    public function initialize(array $config)
    {
        $this->table('seminars');

        $this->belongsToMany('Mandator', [
            'foreignKey' => 'seminar_id',
            'targetForeignKey' => 'mandator_id',
            'joinTable' => 'mandators_seminars'
        ]);	
    }	
}

```

both table are belong to ‘mandators\_seminars’ table

mandator\_id  
seminar\_id

When I save data it’s save in seminar table but not in ‘mandators\_seminars’ table

Query

```
$seminartable = $this->Seminar->newEntity();

$this->request->data['mandator'][0] = 1;

$seminardata = $this->Seminar->patchEntity($seminartable, $this->request->data);
$this->Seminar->save($seminardata)

```

request data

```
Array
(
    [bookable] => test
    [released] => aaa
    [linkable] => bb
    [name] => ccc
    [internalnote] => ddd
    [abstract] => ttt
    [description] => ddd
    [Category] => 14
    [mandator] => Array
        (
            [0] => 1
        )

    [mandator_owner_id] => 1
)

```

what I am missing. Please help
