public function mergeFrom(Doctrine_Record $r) { $object = $this->getInvoker(); if (!$r->exists() || !$object->exists()) { return false; } foreach ($r->getCustomFields() as $key => $value) { $existingValue = $object->getCustomField($key); if ($existingValue === false) { $object->setCustomField($key, $value); } $r->removeCustomField($key); } return true; }