change trigger to detect move in and move out

This commit is contained in:
2016-04-18 22:14:25 +02:00
parent 01ada90e8c
commit f19c60eacd
9 changed files with 278 additions and 3 deletions

View File

@@ -4,6 +4,8 @@ namespace common\models;
use Yii;
use common\components\Helper;
use yii\behaviors\TimestampBehavior;
use yii\helpers\ArrayHelper;
/**
* This is the model class for table "door_log".
@@ -30,6 +32,17 @@ class DoorLog extends \yii\db\ActiveRecord
{
return 'door_log';
}
public function behaviors()
{
return ArrayHelper::merge( [
[
'class' => TimestampBehavior::className(),
'value' => function(){ return date('Y-m-d H:i:s' ); },
'updatedAtAttribute' => false,
]
], parent::behaviors());
}
/**
* @inheritdoc