123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- <?php /** Created by Anton on 11.02.2020. */
- namespace app\models\entity\ar;
- use app\models\entity\Tasks;
- use app\models\entity\Tasktypes;
- use yii\db\ActiveRecord;
- /**
- * This is the model class for table "ar_scenarios".
- *
- * @property int $id
- * @property string $name [varchar(155)]
- * @property int $status
- * @property-read Stage[] $stages
- * @property-read Tasks[] $tasks
- * @property-read Tasktypes[] $tasktypes
- */
- class Scenario extends ActiveRecord
- {
- /**
- * {@inheritdoc}
- */
- public static function tableName()
- {
- return 'ar_scenarios';
- }
- /**
- * {@inheritdoc}
- */
- public function rules()
- {
- return [];
- }
- /**
- * {@inheritdoc}
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'name' => 'Название сценария',
- ];
- }
- public function getStages()
- {
- return $this->hasMany(Stage::class, ['scenario_id' => 'id']);
- }
- public function getTasks()
- {
- return $this->hasMany(Tasks::class, ['scenario_id' => 'id']);
- }
- public function getTasktypes()
- {
- return $this->hasMany(Tasktypes::class, ['scenario_id' => 'id']);
- }
- public function fillFromArray($params)
- {
- $this->name = $params['name'];
- }
- public function asArray()
- {
- return [
- 'id' => $this->id,
- 'name' => $this->name
- ];
- }
- }
|