getUsers() public method

Alias for $this->getItems()
public getUsers ( ) : array
return array
Example #1
0
 public function searchAction()
 {
     $q = "%" . $this->getParam("query") . "%";
     $list = new User\Listing();
     $list->setCondition("name LIKE ? OR firstname LIKE ? OR lastname LIKE ? OR email LIKE ? OR id = ?", [$q, $q, $q, $q, intval($this->getParam("query"))]);
     $list->setOrder("ASC");
     $list->setOrderKey("name");
     $list->load();
     $users = [];
     if (is_array($list->getUsers())) {
         foreach ($list->getUsers() as $user) {
             if ($user instanceof User && $user->getId() && $user->getName() != "system") {
                 $users[] = ["id" => $user->getId(), "name" => $user->getName(), "email" => $user->getEmail(), "firstname" => $user->getFirstname(), "lastname" => $user->getLastname()];
             }
         }
     }
     $this->_helper->json(["success" => true, "users" => $users]);
 }
Example #2
0
 /**
  *
  */
 public function delete()
 {
     // delete all childs
     $list = new Listing();
     $list->setCondition("parentId = ?", $this->getId());
     $list->load();
     if (is_array($list->getUsers())) {
         foreach ($list->getUsers() as $user) {
             $user->delete();
         }
     }
     // now delete the current user
     $this->getDao()->delete();
     \Pimcore\Cache::clearAll();
 }