Many to many relation in template

Hello.
I have following tables:
[ Product ] <=> [ ProductsFilters ] <=> [ ProductFilters ]
Now I want in Products => add template, add checkboxes to choose which filters should be in my new product.
For example. I’m creating product and I want 3 filters to describe my product.
I’m playing with this but it creates only one ProductsFilters row [ product_id is good, but product_filter_id is 0]

<?= $this->Form->control('products_filters[product_filter_id]', [
	'label' => '',
	'type' => 'select',
	'multiple' => 'checkbox',
	'hiddenField' => false,
	'options' => collection($filter->children)->combine('id', 'name')->toArray()
]); ?>

You need 3 Tables:
products (id, name,…)
filters (id, name,…)
filters_products (id, filter_id, product_id)

in your Products add Form:

$this->Form-control('filters_ids,[‘options’=>$filters,‘multiple’=>'checkbox]);

in your Products Controller in method “add”

$filters = $this->Products->Filters->find(‘list’,[‘limit’=>5];
$this->set(compact(‘filters’));

I think you need to name your input field products_filters._ids.

@Zuluru @dirk yours solutions don’t work

Sorry, my mistake. product_filters._ids. The part before the period needs to be the same as the name of the property in the product entity where that list will be found if you read it from the database with the relevant containment. In your case, that’s product_filters, not products_filters.