2021-06-07 17:18:49 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace common\models;
|
|
|
|
|
|
|
|
use Yii;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This is the model class for table "reports_task".
|
|
|
|
*
|
|
|
|
* @property int $id
|
|
|
|
* @property int $report_id
|
|
|
|
* @property string $task
|
|
|
|
* @property int $created_at
|
|
|
|
* @property int $status
|
2021-11-23 10:55:41 +03:00
|
|
|
* @property int $minutes_spent
|
2021-06-07 17:18:49 +03:00
|
|
|
* @property float $hours_spent
|
|
|
|
*
|
|
|
|
* @property Reports $report
|
|
|
|
*/
|
|
|
|
class ReportsTask extends \yii\db\ActiveRecord
|
|
|
|
{
|
2024-02-01 00:57:42 +03:00
|
|
|
// const SCENARIO_WITHOUT_REPORT_ID = 'withoutReportID';
|
|
|
|
//
|
|
|
|
// public function scenarios()
|
|
|
|
// {
|
|
|
|
// $scenarios = parent::scenarios();
|
|
|
|
// $scenarios[self::SCENARIO_WITHOUT_REPORT_ID] = self::attributes();
|
|
|
|
// return $scenarios;
|
|
|
|
// }
|
2021-11-29 18:16:28 +03:00
|
|
|
|
2021-06-07 17:18:49 +03:00
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*/
|
|
|
|
public static function tableName()
|
|
|
|
{
|
|
|
|
return 'reports_task';
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*/
|
|
|
|
public function rules()
|
|
|
|
{
|
|
|
|
return [
|
2024-02-01 00:57:42 +03:00
|
|
|
//[['report_id'], 'required', 'on' => self::SCENARIO_DEFAULT],
|
2021-11-23 10:55:41 +03:00
|
|
|
[['report_id', 'created_at', 'status', 'minutes_spent'], 'integer'],
|
2021-06-07 17:18:49 +03:00
|
|
|
[['hours_spent'], 'number'],
|
2021-11-23 10:55:41 +03:00
|
|
|
['minutes_spent', 'compare', 'compareValue' => 60, 'operator' => '<'],
|
2021-06-07 17:18:49 +03:00
|
|
|
[['task'], 'string'],
|
|
|
|
[['report_id'], 'exist', 'skipOnError' => true, 'targetClass' => Reports::className(), 'targetAttribute' => ['report_id' => 'id']],
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*/
|
|
|
|
public function attributeLabels()
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
'id' => 'ID',
|
|
|
|
'report_id' => 'Report ID',
|
|
|
|
'task' => 'Task',
|
|
|
|
'created_at' => 'Created At',
|
|
|
|
'status' => 'Status',
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return \yii\db\ActiveQuery
|
|
|
|
*/
|
|
|
|
public function getReport()
|
|
|
|
{
|
|
|
|
return $this->hasOne(Reports::className(), ['id' => 'report_id']);
|
|
|
|
}
|
|
|
|
}
|