将对象复制到其他表 - Symfony 1.4

I have two table:

First:
id | name  | password
 1 | peter | old

Second:
id | name  | password

I get object from table First:

$first = Doctrine::getTable('First')->find(1);

$copy = $first->copy();

$second = new Second($first);
$second->save();

or

$second = new Second($copy);
$second->save();

In both cases i have:

Second:
id | name  | password
 1 | NULL  | NULL 
 2 | NULL  | NULL

Is possible to make this copy?

Have you tried with toArray / fromArray ?

$first = Doctrine::getTable('First')->find(1);

$second = new Second();
$second->fromArray($first->toArray());
$second->save();

Sure, but I don't think like this. Where did you see that? I don't think you can pass one entity as a parameter to the constructor of another.

Just do it manually or use reflection to copy all the fields:

$first = Doctrine::getTable('First')->find(1);

$second = new Second();
$second->setValue1($first->getValue1());
$second->setValue2($first->getValue2());
...
$second->save();

Why wouldn't you use clone? It's less cumbersome than using toArray, fromArray.

$first = Doctrine::getTable('First')->find(1);
//do whatever to $first here...

$second = clone $first;
$second->save();

You may have to set the ID field on $second to null though.