Bolt\Storage\Repository\UsersRepository::getUsers PHP Method

getUsers() public method

Get all the system users.
public getUsers ( ) : Bolt\Storage\Entity\Users[] | false
return Bolt\Storage\Entity\Users[] | false
    public function getUsers()
    {
        $userEntities = $this->findAll();
        if ($userEntities) {
            foreach ($userEntities as $userEntity) {
                $this->unsetSensitiveFields($userEntity);
            }
        }
        return $userEntities;
    }

Usage Example

Exemplo n.º 1
0
 /**
  * Get an array with the current users.
  *
  * @return array[]
  */
 public function getUsers()
 {
     if (!empty($this->users)) {
         return $this->users;
     }
     try {
         if (!($tempusers = $this->repository->getUsers())) {
             return [];
         }
         /** @var \Bolt\Storage\Entity\Users $userEntity */
         foreach ($tempusers as $userEntity) {
             $id = $userEntity->getId();
             $this->users[$id] = $userEntity->toArray();
         }
     } catch (TableNotFoundException $e) {
         return [];
     }
     return $this->users;
 }