getUser() protected method

Get a user from the Security Token Storage.
See also: TokenInterface::getUser()
protected getUser ( ) : mixed
return mixed
Example #1
0
 public function getUser($apiKey = null)
 {
     // get the logged user
     $user = parent::getUser();
     if (null === $user) {
         // if the logged user doesn't exist, check if there's an api key
         if (null !== $apiKey) {
             $em = $this->getDoctrine()->getEntityManager();
             $user = $em->getRepository("ZeegaDataBundle:User")->findOneBy(array("apiKey" => $apiKey));
             if (null !== $user) {
                 return $user;
             }
         }
     } else {
         if ($this->container->get('security.context')->isGranted('IS_AUTHENTICATED_FULLY')) {
             return $user;
         }
     }
     return null;
 }
 public function getUser()
 {
     return parent::getUser();
 }
Example #3
0
 /**
  * @return User|null
  */
 protected function getUser()
 {
     return parent::getUser();
 }