本文整理汇总了PHP中AIR2_Record::save方法的典型用法代码示例。如果您正苦于以下问题:PHP AIR2_Record::save方法的具体用法?PHP AIR2_Record::save怎么用?PHP AIR2_Record::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AIR2_Record
的用法示例。
在下文中一共展示了AIR2_Record::save方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
/**
* 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();
}
示例2: 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;
}
示例3: save
/**
* 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;
}
示例4: save
/**
* 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;
}
示例5: save
/**
* 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;
}
示例6: resolve_conflicts
/**
* 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}");
}
}
}