findOne()
ищет по первичному ключу, по id. поэтому и не находит
надо так:
$user = User::find()->where(['username'=>$this->username])->one()
а что бы не было таких ошибок, добавлять if
public function editdata()
{
if($user = User::find()->where(['username'=>$this->username])->one()){
if($this->email != null)$user->email = $this->email;
if($this->fio != null)$user->fio = $this->fio;
if($this->apartment != null)$user->apartment = $this->apartment;
if($this->house != null)$user->house = $this->house;
if($this->housing != null)$user->housing = $this->housing;
if($this->street != null)$user->street = $this->street;
if($this->phone != null)$user->phone = $this->phone;
if($this->password != null)$user->setPassword($this->password);
return $user->save();
}
return false;
}