I am using Cakephp 2.4.5. I have 2 tables with a one-to-many relationship. Table B belongs to Table A. Table A has many Table B.
I want a controller in Table A that can save records in Table A and Table B. The controller code should be simple and looks like this; public function add_tableA($id=null){ if ($this->request->is('post')) { $this->layout = null ; $this->TableA->create(); $this->TableA->saveAll($this->request->data, array('deep' => true)); }} My problem comes when trying to send the right HTTP POST format to the controller. I tried to HTTP POST the data format below but it fails. data[TableA][field1] = field1_value data[TableA][field2] = field2_value data[TableB][field1] = field1_value data[TableB][field2] = field2_value Then, I try to HTTP POST the data format below, at least TableA fields are populated. data[TableA][field1] = field1_value data[TableA][field2] = field2_value How should the HTTP POST data format look like if I want to create rows for both tables? -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.