/** * Override save() to workaround Doctrine bug in cascading save(). * * @return parent::save() */ public function save() { if (!$this->iorg_org_id) { throw new Exception("iorg_org_id not set"); } return parent::save(); }
/** * Override save() to set src_status after all children are saved. * Apparently the postSave() hook happens *before* children are saved, * which means the set_src_status() algorithm has immature data. * * @param Doctrine_Connection $conn * @return unknown */ public function save(Doctrine_Connection $conn = null) { $ret = parent::save($conn); $this->set_and_save_src_status(); return $ret; }
/** * Override save() to dump to std_err * * @param object $conn (optional) * @return return value from parent::save($conn) */ public function save(Doctrine_Connection $conn = null) { if (strlen($this->smadd_zip) && strlen($this->smadd_zip) < 5 && preg_match('/^\\d+$/', $this->smadd_zip)) { $this->smadd_zip = '0' . $this->smadd_zip; } $ret = parent::save($conn); return $ret; }
/** * Override save() to update the parent Source's status * and queue any actions necessary at Lyris on sem_status change. * * @param object $conn (optional) * @return return value from parent::save($conn) */ public function save(Doctrine_Connection $conn = null) { $modified = $this->getModified(); $ret = parent::save($conn); $src = $this->Source; $src->set_and_save_src_status(); // if EITHER the status or email has changed, tell email provider about it $email_changed = array_key_exists('sem_email', $modified) ? $modified['sem_email'] : false; $status_changed = array_key_exists('sem_status', $modified) ? $modified['sem_status'] : false; if ($email_changed || $status_changed) { $this->_queue_manager_status_change($email_changed, $status_changed); } return $ret; }
/** * Fixing the * * @param * @return return value from parent::save($conn) */ public function save(Doctrine_Connection $conn = null) { $zip = $this->smadd_zip; if (strlen($zip) == 4) { $this->smadd_zip = '0' . $zip; } $this->sph_number = preg_replace('/\\D/', '', $this->sph_number); $ret = parent::save($conn); return $ret; }
/** * Attempts to discriminate data being saved to a record, tracking any * conflicts. Note that the AIR2_Record->discriminate() method should * save the record, so call it from a try-catch. * * @param AIR2_Record $rec * @param array $data * @param TankSource $tsrc * @param int $op */ protected function resolve_conflicts($rec, $data, $tsrc, $op = null) { // ignore this piece of the tank_source if ($op == AIR2_DISCRIM_IGNORE) { return; } // unset any null data vals foreach ($data as $key => $val) { if (is_null($val)) { unset($data[$key]); } elseif (is_string($val) && strlen($val) == 0) { unset($data[$key]); } } // discriminate, if we have data if (count($data) > 0) { $rec->discriminate($data, $tsrc, $op); // try to save the record try { $rec->save(); } catch (Doctrine_Validator_Exception $e) { $cls = get_class($rec); $stack = $rec->getErrorStack()->toArray(); foreach ($stack as $col => $problem) { $tsrc->add_conflict($cls, $col, $problem); } } catch (Exception $e) { $cls = get_class($rec); $msg = $e->getMessage(); $tsrc->add_error("FATAL ERROR on {$cls} - {$msg}"); } } }