fitness-web/backend/models/TicketUpdate.php

43 lines
953 B
PHP

<?php
namespace backend\models;
use common\models\Ticket;
class TicketUpdate extends Ticket{
public $startDate;
public $endDate;
public $timestampStart;
public $timestampEnd;
public function rules()
{
return [
[['comment'], 'required'],
[['comment'], 'string', 'max' => 255],
[[ 'startDate','endDate' ], 'required'],
[[ 'startDate', ], 'date' , 'timestampAttribute' => 'timestampStart' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ],
[[ 'endDate' , ], 'date' , 'timestampAttribute' => 'timestampEnd' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ],
[['status',], 'integer'],
[['status',], 'in', 'range' => [ static ::STATUS_ACTIVE, static ::STATUS_INACTIVE ]],
];
}
public function beforeSave($insert){
if ( $insert ){
return false;
}
if ( parent::beforeSave($insert)){
$this->start = $this->startDate;
$this->end = $this->endDate;
return true;
}
return false;
}
}