/** * @param Bronto_Api_Contact_Row $contact * @param bool $persistOnly * * @return Bronto_Api_Contact_Row */ public function saveContact(Bronto_Api_Contact_Row $contact, $persistOnly = false) { if ($persistOnly) { $contact->persist(); } else { try { if ($contact->id) { $this->writeDebug("Updating existing Contact: ({$contact->email})..."); } else { $this->writeDebug("Saving new Contact: ({$contact->email})..."); } $contact->save(false); } catch (Exception $e) { $this->writeError($e); } } $this->writeVerboseDebug('===== CONTACT SAVE =====', 'bronto_common_api.log'); $this->writeVerboseDebug(var_export($contact->getApi()->getLastRequest(), true), 'bronto_common_api.log'); $this->writeVerboseDebug(var_export($contact->getApi()->getLastResponse(), true), 'bronto_common_api.log'); return $contact; }
/** * @param Bronto_Api_Contact_Row $contact * @param bool $persistOnly * * @return Bronto_Api_Contact_Row */ public function saveContact(Bronto_Api_Contact_Row $contact, $persistOnly = false) { if ($persistOnly) { $contact->persist(); } else { try { if ($contact->id) { $this->writeDebug("Updating existing Contact: ({$contact->email})..."); } else { $this->writeDebug("Saving new Contact: ({$contact->email})..."); } $contact->save(false); } catch (Exception $e) { $this->writeError($e); } $this->_flushApiLogs($contact->getApi()); } return $contact; }