public function getRoles() { $roles = []; foreach ($this->options as $key => $value) { $name = is_numeric($key) ? $value : $key; $parents = is_array($value) && count($value) > 0 ? $value : null; $role = new Role($name); $role->setParents($parents); $roles[] = $role; } return $roles; }
public function getRoles() { /** @var \Mongo\Db $db */ $db = $this->serviceLocator->get('Mongo\\Service\\MasterConnector'); /** @var \Acl\Mapper\Role $roleMapper */ $roleMapper = $this->serviceLocator->get('Acl\\Mapper\\Role'); $roleMapper->setDb($db); $roles = $roleMapper->find(); if ($roles == null) { return []; } $return = []; foreach ($roles as $role) { $r = new Role($role->name); $r->setParents($role->parent); $return[] = $r; } return $return; }