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 
14 {
18  protected $_idFieldName = 'customer_group_id';
19 
25  protected function _construct()
26  {
27  $this->_init(\Magento\Customer\Model\Group::class, \Magento\Customer\Model\ResourceModel\Group::class);
28  }
29 
36  public function setIgnoreIdFilter($indexes)
37  {
38  if (count($indexes)) {
39  $this->addFieldToFilter('main_table.customer_group_id', ['nin' => $indexes]);
40  }
41  return $this;
42  }
43 
49  public function setRealGroupsFilter()
50  {
51  return $this->addFieldToFilter('customer_group_id', ['gt' => 0]);
52  }
53 
59  public function addTaxClass()
60  {
61  $this->getSelect()->joinLeft(
62  ['tax_class_table' => $this->getTable('tax_class')],
63  "main_table.tax_class_id = tax_class_table.class_id"
64  );
65  return $this;
66  }
67 
73  public function toOptionArray()
74  {
75  return parent::_toOptionArray('customer_group_id', 'customer_group_code');
76  }
77 
83  public function toOptionHash()
84  {
85  return parent::_toOptionHash('customer_group_id', 'customer_group_code');
86  }
87 }