Doctrine - Set One Object Equal to Another
In Doctrine / Php / MySQL, im trying to pull one record fr开发者_C百科om the DB that is in Table A. I then want to take that row, and insert it into Table B (which has the exact same structure as Table A).
Whats the best way to do this?
If the two tables have identical structures I think you can do something like:
$B = new TableB();
$B->fromArray($A->toArray());
$B->save();
this is ok only for few records. If you need to copy a lot of records and need performances use PDO with insert into B/select from A type queries!
精彩评论