Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Collection.php
Go to the documentation of this file.
1 <?php
7 
9 
17 {
23  protected function _construct()
24  {
25  $this->_init(\Magento\Authorization\Model\Role::class, \Magento\Authorization\Model\ResourceModel\Role::class);
26  }
27 
35  public function setUserFilter($userId, $userType)
36  {
37  $this->addFieldToFilter('user_id', $userId);
38  $this->addFieldToFilter('user_type', $userType);
39  return $this;
40  }
41 
47  public function setRolesFilter()
48  {
49  $this->addFieldToFilter('role_type', RoleGroup::ROLE_TYPE);
50  return $this;
51  }
52 
58  public function toOptionArray()
59  {
60  return $this->_toOptionArray('role_id', 'role_name');
61  }
62 }
_toOptionArray($valueField=null, $labelField='name', $additional=[])
Definition: AbstractDb.php:641