| Current Path : /var/www/html/dyna-project/models/ |
| Current File : /var/www/html/dyna-project/models/Step.php |
<?php
namespace app\models;
use Yii;
use app\models\Phase;
/**
* This is the model class for table "step".
*
* @property int $id
* @property int $phase_id
* @property string $code
* @property string $name
* @property string $track
* @property int $sort
* @property string $assignto
* @property int $duration
* @property int $status
* @property string $created_dt
* @property int $created_by
* @property string $updated_dt
* @property int $updated_by
*/
class Step extends \yii\db\ActiveRecord {
/**
* {@inheritdoc}
*/
public static function tableName() {
return 'step';
}
/**
* {@inheritdoc}
*/
public function rules() {
return [
[['name', 'duration', 'assignto'], 'required'],
[['phase_id', 'sort', 'status', 'created_by', 'updated_by'], 'integer'],
[['created_dt', 'updated_dt', 'start_day', 'start_id'], 'safe'],
[['code'], 'string', 'max' => 10],
[['name', 'track', 'assignto'], 'string', 'max' => 255],
[['code'], 'unique'],
];
}
/**
* {@inheritdoc}
*/
public function attributeLabels() {
return [
'id' => 'ID',
'phase_id' => 'Phase ID',
'code' => 'Code',
'name' => 'Name',
'track' => 'Track Progress',
'sort' => 'Step Order',
'assignto' => 'Assign To',
'duration' => 'Duration',
'status' => 'Status',
'created_dt' => 'Created Dt',
'created_by' => 'Created By',
'updated_dt' => 'Updated Dt',
'updated_by' => 'Updated By',
'start_day' => 'Start Task On',
'start_id' => 'Task Selected'
];
}
public function getstepno($id) {
$output = '';
if (($model = static::findOne($id)) !== null) {
if (($model2 = Phase::findOne($model->phase_id)) !== null) {
$output = $model2->sort . '.' . $model->sort;
}
}
return $output;
}
}