本文整理汇总了PHP中BaseActiveRecordVersioned类的典型用法代码示例。如果您正苦于以下问题:PHP BaseActiveRecordVersioned类的具体用法?PHP BaseActiveRecordVersioned怎么用?PHP BaseActiveRecordVersioned使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BaseActiveRecordVersioned类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: afterValidate
public function afterValidate()
{
if (!$this->reading_id && !$this->qualitative_reading_id) {
$this->addError('reading_id', 'Either a numerical reading or a qualitative reading must be specified.');
}
return parent::afterValidate();
}
示例2: beforeSave
public function beforeSave()
{
if (!$this->end_date) {
$this->stop_reason_id = null;
}
return parent::beforeSave();
}
示例3: beforeValidate
protected function beforeValidate()
{
if (!$this->isAllowed()) {
$this->addError('recipient_email', 'Recipient email is not in the list of allowed domains');
}
return parent::beforeValidate();
}
示例4: beforeSave
protected function beforeSave()
{
if (!parent::beforeSave() || !$this->getPatientMeasurement()->save()) {
return false;
}
$this->patient_measurement_id = $this->getPatientMeasurement()->id;
return true;
}
示例5: 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();
}
示例6: afterConstruct
/**
* set a default display order for a new record.
*/
protected function afterConstruct()
{
parent::afterConstruct();
if (!$this->display_order) {
$criteria = new CDbCriteria();
$criteria->order = 'display_order desc';
$criteria->limit = 1;
$model = get_class($this);
$bottom = $model::model()->find($criteria);
if ($bottom) {
$this->display_order = $bottom->display_order + 1;
} else {
$this->display_order = 1;
}
}
}
开发者ID:openeyes,项目名称:openeyes,代码行数:19,代码来源:OphTrOperationbooking_Operation_Session_UnavailableReason.php
示例7: afterDelete
/**
* ensures file is removed from filesystem when deleting
*
*/
public function afterDelete()
{
unlink($this->_stored_path);
return parent::afterDelete();
}
示例8: __isset
/**
* @param string $prop
* @return bool
*/
public function __isset($prop)
{
$method = "get_" . $prop;
if (method_exists($this, $method)) {
return true;
}
return parent::__isset($prop);
}
示例9: delete
public function delete()
{
if ($this->children) {
foreach ($this->children as $child) {
if (!$child->delete()) {
return false;
}
}
}
return parent::delete();
}
示例10: beforeSave
protected function beforeSave()
{
if ($this->start_date && !preg_match('/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/', $this->start_date)) {
$this->start_date = date('Y-m-d', strtotime($this->start_date));
}
if ($this->end_date && !preg_match('/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/', $this->end_date)) {
$this->end_date = date('Y-m-d', strtotime($this->end_date));
}
$this->default_admission_time = $this->setDefaultAdmissionTime($this->default_admission_time, $this->start_time);
return parent::beforeSave();
}
示例11: beforeValidate
protected function beforeValidate()
{
return parent::beforeValidate();
}
示例12: 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();
}
示例13: afterValidate
/**
* assignment field validation.
*/
public function afterValidate()
{
// validate any widget fields in the assignment_fields attribute
foreach ($this->getAssignmentFieldDefinitions() as $i => $fld) {
if (!($id = @$fld['id'])) {
$this->addError('assignment_fields', 'ID required for assignment field ' . ($i + 1));
continue;
}
if (@$fld['type'] == 'widget') {
if (!@$fld['widget_name']) {
$this->addError('assignment_fields', 'Widget Name missing for ' . $id);
} elseif (!is_file(\Yii::getPathOfAlias('application.modules.PatientTicketing.widgets.' . $fld['widget_name']) . '.php')) {
$this->addError('assignment_fields', 'Widget with name ' . $fld['widget_name'] . ' for ' . $id . ' not defined');
}
}
}
parent::afterValidate();
}
示例14: instantiate
/**
* Override to allow us to have classes defined outside of core that store the data in a different way
*
* @param array $attributes
* @return CActiveRecord
*/
protected function instantiate($attributes)
{
if (isset($attributes['patient_measurement_id'])) {
if ($pm = PatientMeasurement::model()->findByPk($attributes['patient_measurement_id'])) {
$origin = $pm->originReference;
if ($origin && $origin->event) {
$api = Yii::app()->moduleAPI->getForEventId($origin->event_id);
if ($api) {
OELog::log("we have an api");
return $api->getMeasurementClassForEventId($origin->event_id);
}
}
}
}
return parent::instantiate($attributes);
}
示例15: beforeValidate
/**
* check the time entry is valid.
*
* @return bool
*/
public function beforeValidate()
{
if (!preg_match('/^(([01]?[0-9])|(2[0-3])):?[0-5][0-9]$/', $this->measurement_timestamp)) {
$this->addError('measurement_timestamp', 'Invalid ' . $this->getAttributeLabel('measurement_timestamp'));
}
return parent::beforeValidate();
}