I have a table with many-to-many relationships. I want to save the data in an intermediate table, but nothing happens.
it`s my controller :
public function cart()
{
$order = $this->Clients_products->newEntity();
if ($this->request->is('ajax')) {
$order->client_id = 2;
$order->product_id = 2;
if ($this->Clients_products->save($order)) {
$this->Flash->success(__('OP!! OP!! OP!!.'));
}else{
$this->Flash->success(__('Hyi v sraky jitsa v rot.'));
}
}
}
it`s my BD :