开发者

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!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜