During
Doctrine_Collection::fromArray
(synchronizeFromArray
too) record primary keys (DoctrineRecord::_id
array) won't get updated.DoctrineRecord::toArray()
will overwrite all primary key column values with result ofDoctrineRecord::getIncremented()
which because of point 1. is empty.
One way to deal with this is to modify your $p
array before you perform fromArray()
.
Inside your array you should change your primary key name to _identifier
.
In your case simplest solution would be to modify your SQL query:
$sql = "SELECT `id` as `_identifier`, * FROM payments LIMIT 1";
This way following code from Doctrine_Record::fromArray():
if ($key == '_identifier') {
$refresh = true;
$this->assignIdentifier($value);
continue;
}
will assign proper _id
array to your records.