add doorlog version , improve DoorMoveForm.php required fields
This commit is contained in:
parent
8ab87f1f22
commit
7252f835a0
@ -64,6 +64,7 @@ class DoorManager extends BaseObject
|
||||
$dateStr = DateUtil::formatDateUtc($date);
|
||||
|
||||
$doorLog = new DoorLog();
|
||||
$doorLog->version = 2;
|
||||
if ( $device == 'E'){
|
||||
$direction = DoorLog::$DIRECTION_ALL_EMERGENCY;
|
||||
}else{
|
||||
|
||||
@ -22,6 +22,7 @@ use yii\helpers\ArrayHelper;
|
||||
* @property integer id_ticket_current
|
||||
* @property integer card_flag
|
||||
* @property integer flag_out
|
||||
* @property integer version
|
||||
*/
|
||||
class DoorLog extends \yii\db\ActiveRecord
|
||||
{
|
||||
|
||||
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
use yii\db\Migration;
|
||||
|
||||
/**
|
||||
* Class m220803_190701_alter_table_door_log_add_version
|
||||
*/
|
||||
class m220803_190701_alter_table_door_log_add_version extends Migration
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function safeUp()
|
||||
{
|
||||
$this->addColumn('door_log', 'version', $this->integer( )->notNull()->defaultValue(1) );
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function safeDown()
|
||||
{
|
||||
echo "m220803_190701_alter_table_door_log_add_version cannot be reverted.\n";
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
// Use up()/down() to run migration code without a transaction.
|
||||
public function up()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
echo "m220803_190701_alter_table_door_log_add_version cannot be reverted.\n";
|
||||
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
}
|
||||
@ -17,8 +17,8 @@ class DoorMoveForm extends Model
|
||||
|
||||
public function rules( ) {
|
||||
return [
|
||||
[ ['cardNumber', 'device', 'direction', 'validateOnly' ], 'required'],
|
||||
[ ['createdAt', 'date' ], 'string']
|
||||
[ [ 'device', 'validateOnly' ], 'required'],
|
||||
[ [ 'cardNumber', 'device', 'direction', 'validateOnly' , 'createdAt', 'date' ], 'string']
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user