123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- <?php
- namespace app\models\entity;
- use yii\db\ActiveRecord;
- /**
- * This is the model class for table "tasks".
- *
- * @property int $id
- * @property bool $status [tinyint(3) unsigned] пояснения в таблице имен статусов
- * @property int $parent_id [int(10) unsigned]
- * @property int $project_id [int(10) unsigned] внешний ключ к таблице projects_locotech
- * @property int $scenario_id [int(10) unsigned] внешний ключ к ar_scenarios
- * @property int $type [int(10) unsigned]
- * @property int $assignees_arr [int(255) unsigned]
- * @property bool $priority [tinyint(3) unsigned]
- * @property int $input_id [int(10) unsigned] номер задания во входной таблице
- * @property string $created [datetime]
- * @property string $assigned [datetime]
- * @property string $accepted_time [datetime]
- * @property string $finished_time [datetime]
- * @property string $expires [datetime]
- * @property string $followers_arr [varchar(255)]
- * @property int $assignedby [int(10) unsigned]
- * @property string $text [varchar(255)]
- * @property string $viewed_by_arr [varchar(255)]
- * @property string $working_arr [varchar(255)]
- * @property string $confirm_data [varchar(255)]
- * @property bool $control_map_checked [tinyint(3) unsigned]
- * @property int $account_id [int(10) unsigned]
- * @property int $asusg_job_mapped_id [int(10) unsigned]
- * @property int $object_id [int(55) unsigned]
- * @property int $preferred_assignee [int(10) unsigned]
- *
- * @property Tasktypes $tasktypes
- * @property Accounts $accounts
- */
- class Tasks extends ActiveRecord
- {
- /**
- * @return string название таблицы, сопоставленной с этим ActiveRecord-классом.
- */
- public static function tableName()
- {
- return '{{tasks}}';
- }
- public function getProject()
- {
- return $this->hasOne(ProjectsLocotech::class, ['id' => 'input_id']);
- }
-
- public function getAccounts()
- {
- return $this->hasOne(Accounts::class, ['id' => 'assignees_arr']);
- }
-
- public function getTasktypes()
- {
- return $this->hasOne(Tasktypes::class, ['id' => 'type']);
- }
-
- public function getTasktypesjobtype()
- {
- return $this->hasOne(TasktypesJobtype::class, ['tasktype_id' => 'type']);
- }
-
- public function getPhase()
- {
- return $this->hasMany(Phase::class, ['task_id' => 'id']);
- }
- public function getAsusgjob2launch()
- {
- return $this->hasOne(AsusgJob2Launch::class, ['id' => 'asusg_job_mapped_id']);
- }
- public function getCommandId()
- {
- if ($this->parent_id == 0) {
- return 0;
- }
- return $this->id;
- }
- public function getTaskId()
- {
- if ($this->parent_id == 0) {
- return $this->id;
- }
- return 0;
- }
- public function asArray()
- {
- return [
- 'command_id' => $this->getCommandId(),
- 'task_id' => $this->getTaskId(),
- 'scenario_id' => $this->scenario_id,
- 'command_name' => $this->tasktypes->name
- ];
- }
- /**
- * @return Tasks[]
- */
- public function getCommands()
- {
- return Tasks::findAll(['parent_id' => $this->id]);
- }
- }
|