255], [['user_id'], 'exist', 'skipOnError' => true, 'targetClass' => User::class, 'targetAttribute' => ['user_id' => 'id']], [['file'], 'file', 'extensions' => 'jpg, png'], ]; } /** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => 'ID', 'user_id' => 'Пользователь', 'created_at' => 'Когда создан', 'image' => 'Картинка', 'activity' => 'Активность', ]; } /** * Gets query for [[Texts]]. * * @return \yii\db\ActiveQuery */ public function getTexts() { return $this->hasMany(Text::class, ['profile_id' => 'id']); } /** * Gets query for [[User]]. * * @return \yii\db\ActiveQuery */ public function getUser() { return $this->hasOne(User::class, ['id' => 'user_id']); } public function getStatusLabel() { if ($this->activity == self::STATUS_ACTIVE) return 'Активен'; else return 'Не активен'; } /** * @param string $lang * @return \yii\db\ActiveQuery */ public function getTextByLanguage(string $lang) { return $this->hasMany(Text::class, ['profile_id' => 'id', 'language' => $lang]); } }