public function registrat() { if (!$this->validate()) { return null; } $user = new User(); $user->username = $this->username; ...