protected function getUsername() { // initialize the name $name = null; // query whether or not we've an principal if ($identity = $this->getIdentity()) { $name = $identity->getName(); } // return the name return $name; }