I would do it at the database level if you have that option, using a INSERT
INTO table ... SELECT ...
See MySQL 5.0 documentation at:
http://dev.mysql.com/doc/refman/5.0/en/insert-select.html
If you still wish to use CakePHP to do the transfer and the column names in
the tables are not the same, then you need to manually rename the fields
in the array of data you have retrieved for transferring.
Enjoy, John
On Wednesday, 26 March 2014 07:42:08 UTC+2, Sam wrote:
I have 2 similar pairs of tables (Table1 and Table2, TableA and TableB).
Table1 has many Table2. Table2 belongs to Table1. In other words, there is
a one-to-many relationship between Table1 and Table2. TableA and TableB has
the same one-to-many relationship as Table1 and Table2.
I would like to move a row in Table1 plus all the associated rows in
Table2 to the matching table pair TableA and TableB.
What is the best way to transfer the table row and the associated rows? Do
I save each row to the new table one by one using save() or is there a way
to save all the rows at one go using saveall()?
Is it a problem to use saveall() to do the data transfer if the table
fields are similar but not exactly the same. Between the table pair, some
rows are the same and some rows are different.
I am using Cakephp 2.4.5. Thank you for your help.
--
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.