33 lines
812 B
PHP
33 lines
812 B
PHP
<?php
|
|
|
|
namespace common\models;
|
|
|
|
use yii\behaviors\TimestampBehavior;
|
|
use yii\db\ActiveQuery;
|
|
use yii\db\ActiveRecord;
|
|
|
|
class HospitalYardPhysical extends \common\modelsgii\HospitalYardPhysical
|
|
{
|
|
public function behaviors(): array
|
|
{
|
|
return [
|
|
[
|
|
'class' => TimestampBehavior::class,
|
|
'attributes' => [
|
|
ActiveRecord::EVENT_BEFORE_INSERT => ['created_at','updated_at'],
|
|
ActiveRecord::EVENT_BEFORE_UPDATE => ['updated_at'],
|
|
],
|
|
],
|
|
];
|
|
}
|
|
|
|
/**
|
|
* 获取分院信息
|
|
* @return ActiveQuery
|
|
*/
|
|
public function getYard(): ActiveQuery
|
|
{
|
|
return $this->hasOne(HospitalYard::className(),['id'=>'yard_id'])->select('id,name,position,hospital_id');
|
|
}
|
|
}
|