Example #1
0
 public function isUsersExist(array $filters)
 {
     $selection = $this->provider->selectAll($filters);
     $existing = $this->provider->query($selection)->getResult();
     if (count($existing)) {
         foreach ($existing as $exist) {
             if ($exist->getId()) {
                 return true;
             }
         }
     }
     return false;
 }
 public function getDefaultAdminRole()
 {
     /**
      * check if an admin role has been defined in the config
      * if it has, use it for search
      * else, use the default 'administrator'
      */
     $config = $this->getServiceManager()->get('config');
     $adminRole = $config['zfmuscle']['default_admin_role'];
     $filters['name'] = array('strategy' => 'Equals', 'value' => $adminRole);
     $selection = $this->provider->selectAll($filters);
     $result = $this->provider->query($selection)->getResult();
     if (count($result)) {
         foreach ($result as $entity) {
             if ($entity->getId()) {
                 return $entity->getId();
             }
         }
     }
     return false;
 }