public function getUsername() { if ($this->user instanceof UserInterface) { return $this->user->getUsername(); } return (string) $this->user; }