本文整理汇总了PHP中BaseActiveRecordVersioned::beforeSave方法的典型用法代码示例。如果您正苦于以下问题:PHP BaseActiveRecordVersioned::beforeSave方法的具体用法?PHP BaseActiveRecordVersioned::beforeSave怎么用?PHP BaseActiveRecordVersioned::beforeSave使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BaseActiveRecordVersioned
的用法示例。
在下文中一共展示了BaseActiveRecordVersioned::beforeSave方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: beforeSave
public function beforeSave()
{
if (!$this->end_date) {
$this->stop_reason_id = null;
}
return parent::beforeSave();
}
示例2: beforeSave
protected function beforeSave()
{
if (!parent::beforeSave() || !$this->getPatientMeasurement()->save()) {
return false;
}
$this->patient_measurement_id = $this->getPatientMeasurement()->id;
return true;
}
示例3: beforeSave
protected function beforeSave()
{
foreach ($this->findAll('patient_measurement_id = ?', array($this->patient_measurement_id)) as $existing) {
if ($this->episode_id && $this->episode_id == $existing->episode_id) {
throw new Exception("Measurement reference already exists from episode {$this->episode_id} to patient measurement {$this->patient_measurement_id}");
}
if ($this->event_id && $this->event_id == $existing->event_id) {
throw new Exception("Measurement reference already exists from event {$this->event_id} to patient measurement {$this->patient_measurement_id}");
}
if ($this->origin && $existing->origin) {
throw new Exception("Origin reference already exists for patient measurement {$this->patient_measurement_id}");
}
}
return parent::beforeSave();
}
示例4: beforeSave
protected function beforeSave()
{
if ($this->is_automated && !is_string($this->automated_source)) {
$this->automated_source = json_encode($this->automated_source);
}
return parent::beforeSave();
}
示例5: beforeSave
protected function beforeSave()
{
return parent::beforeSave();
}
示例6: beforeSave
/**
* @return bool
*/
public function beforeSave()
{
if ($this->subspecialty_id) {
$this->service_subspecialty_assignment_id = ServiceSubspecialtyAssignment::model()->find('subspecialty_id=?', array($this->subspecialty_id))->id;
}
return parent::beforeSave();
}
示例7: beforeSave
public function beforeSave()
{
foreach (array('first_name', 'last_name', 'dob', 'title', 'primary_phone') as $property) {
if ($randomised = $this->randomData($property)) {
$this->{$property} = $randomised;
}
}
return parent::beforeSave();
}
示例8: beforeSave
public function beforeSave()
{
switch ($this->type) {
case 'site':
$this->firm_id = null;
$this->subspecialty = null;
break;
case 'subspecialty':
$this->firm_id = null;
$this->site_id = null;
break;
case 'firm':
$this->subspecialty_id = null;
$this->site_id = null;
break;
}
return parent::beforeSave();
}
示例9: beforeSave
public function beforeSave()
{
if (parent::beforeSave()) {
if ($this->isNewRecord && !$this->address_type_id) {
// make correspondence the default address type
$this->address_type_id = AddressType::CORRESPOND;
}
return true;
}
return false;
}
示例10: beforeSave
public function beforeSave()
{
$this->primary_gender = $this->primary_gender;
return parent::beforeSave();
}
示例11: beforeSave
protected function beforeSave()
{
if ($this->date && !preg_match('/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/', $this->date)) {
$this->date = date('Y-m-d', strtotime($this->date));
}
$this->default_admission_time = $this->setDefaultAdmissionTime($this->default_admission_time, $this->start_time);
return parent::beforeSave();
}