How to re-save the entity as another row in Doctrine 2

后端 未结 3 1859
眼角桃花
眼角桃花 2020-11-28 04:55

Let\'s say I have entity $e. Is there any generic way to store it as another row, which would have the same entity data but another primary key?

Why I n

3条回答
  •  孤城傲影
    2020-11-28 05:37

    Here's a simple strategy I used that doesn't involve excessive complexity:

    $new->fromArray( $old->toArray() );
    $new->id = NULL;
    

提交回复
热议问题