TimestampBehavior::class, 'createdAtAttribute' => 'created_at', 'updatedAtAttribute' => 'updated_at', 'value' => new Expression('NOW()'), ], ]; } /** * {@inheritdoc} */ public function rules() { return [ [['name'], 'required'], [['description'], 'string'], [['created_at', 'updated_at'], 'safe'], [['name'], 'string', 'max' => 255], [['budget'], 'string', 'max' => 100], [['company_id'], 'exist', 'skipOnError' => true, 'targetClass' => Company::class, 'targetAttribute' => ['company_id' => 'id']], [['hh_id'], 'exist', 'skipOnError' => true, 'targetClass' => Hh::class, 'targetAttribute' => ['hh_id' => 'id']], ]; } /** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => 'ID', 'name' => 'Название', 'description' => 'Описание', 'created_at' => 'Дата создания', 'updated_at' => 'Дата редактирования', 'budget' => 'Бюджет', 'company_id' => 'Компания', 'hh_id' => 'Проект на hh.ru', ]; } /** * @return \yii\db\ActiveQuery */ public function getFieldsValues() { return $this->hasMany(FieldsValue::class, ['project_id' => 'id']); } /** * @return \yii\db\ActiveQuery */ public function getCompany() { return $this->hasOne(Company::class, ['id' => 'company_id']); } /** * @return \yii\db\ActiveQuery */ public function getHh() { return $this->hasOne(Hh::class, ['id' => 'hh_id']); } /** * @return \yii\db\ActiveQuery */ public function getProjectUsers() { return $this->hasMany(ProjectUser::class, ['project_id' => 'id']); } }