Ejemplo n.º 1
0
 /**
  * Class constructor
  *
  * @return void
  */
 protected function _construct()
 {
     parent::_construct();
     $roleId = $this->getRequest()->getParam('rid', false);
     /** @var \Magento\User\Model\ResourceModel\User\Collection $users */
     $users = $this->_userCollectionFactory->create()->load();
     $this->setTemplate('role/users.phtml')->assign('users', $users->getItems())->assign('roleId', $roleId);
 }
Ejemplo n.º 2
0
 /**
  * Retrieve option array
  *
  * @return string[]
  */
 public function getOptionArray()
 {
     $result = [];
     foreach ($this->userCollectionFactory->create() as $user) {
         $result[$user->getId()] = $user->getName();
     }
     return $result;
 }
Ejemplo n.º 3
0
 /**
  * Options getter
  *
  * @return array
  */
 public function toOptionArray()
 {
     if ($this->options === null) {
         $this->options = [['label' => __('Please select'), 'value' => 0]];
         $collection = $this->authorCollectionFactory->create();
         foreach ($collection as $item) {
             $this->options[] = ['label' => $item->getName(), 'value' => $item->getId()];
         }
     }
     return $this->options;
 }