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 
15 {
21  protected function _construct()
22  {
23  $this->_init(
24  \Magento\Authorization\Model\Rules::class,
25  \Magento\Authorization\Model\ResourceModel\Rules::class
26  );
27  }
28 
35  public function getByRoles($roleId)
36  {
37  $this->addFieldToFilter('role_id', (int)$roleId);
38  return $this;
39  }
40 
46  public function addSortByLength()
47  {
48  $length = $this->getConnection()->getLengthSql('{{resource_id}}');
49  $this->addExpressionFieldToSelect('length', $length, 'resource_id');
50  $this->getSelect()->order('length ' . \Magento\Framework\DB\Select::SQL_DESC);
51 
52  return $this;
53  }
54 }
$roleId
Definition: webapi_user.php:22