Collection.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <?php
  2. /**
  3. * Customer group collection
  4. *
  5. * Copyright © Magento, Inc. All rights reserved.
  6. * See COPYING.txt for license details.
  7. */
  8. namespace Magento\Customer\Model\ResourceModel\Group\Grid;
  9. use Magento\Customer\Model\ResourceModel\Group\Collection as GroupCollection;
  10. use Magento\Framework\Api\Search\SearchResultInterface;
  11. use Magento\Framework\Search\AggregationInterface;
  12. /**
  13. * Collection for displaying grid of customer groups
  14. */
  15. class Collection extends GroupCollection implements SearchResultInterface
  16. {
  17. /**
  18. * @var AggregationInterface
  19. */
  20. protected $aggregations;
  21. /**
  22. * @param \Magento\Framework\Data\Collection\EntityFactoryInterface $entityFactory
  23. * @param \Psr\Log\LoggerInterface $logger
  24. * @param \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy
  25. * @param \Magento\Framework\Event\ManagerInterface $eventManager
  26. * @param string $mainTable
  27. * @param string $eventPrefix
  28. * @param string $eventObject
  29. * @param string $resourceModel
  30. * @param string $model
  31. * @param \Magento\Framework\DB\Adapter\AdapterInterface|string|null $connection
  32. * @param \Magento\Framework\Model\ResourceModel\Db\AbstractDb $resource
  33. *
  34. * @SuppressWarnings(PHPMD.ExcessiveParameterList)
  35. */
  36. public function __construct(
  37. \Magento\Framework\Data\Collection\EntityFactoryInterface $entityFactory,
  38. \Psr\Log\LoggerInterface $logger,
  39. \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy,
  40. \Magento\Framework\Event\ManagerInterface $eventManager,
  41. $mainTable,
  42. $eventPrefix,
  43. $eventObject,
  44. $resourceModel,
  45. $model = \Magento\Framework\View\Element\UiComponent\DataProvider\Document::class,
  46. $connection = null,
  47. \Magento\Framework\Model\ResourceModel\Db\AbstractDb $resource = null
  48. ) {
  49. parent::__construct(
  50. $entityFactory,
  51. $logger,
  52. $fetchStrategy,
  53. $eventManager,
  54. $connection,
  55. $resource
  56. );
  57. $this->_eventPrefix = $eventPrefix;
  58. $this->_eventObject = $eventObject;
  59. $this->_init($model, $resourceModel);
  60. $this->setMainTable($mainTable);
  61. }
  62. /**
  63. * Resource initialization
  64. * @return $this
  65. */
  66. protected function _initSelect()
  67. {
  68. parent::_initSelect();
  69. $this->addTaxClass();
  70. return $this;
  71. }
  72. /**
  73. * @return AggregationInterface
  74. */
  75. public function getAggregations()
  76. {
  77. return $this->aggregations;
  78. }
  79. /**
  80. * @param AggregationInterface $aggregations
  81. * @return $this
  82. */
  83. public function setAggregations($aggregations)
  84. {
  85. $this->aggregations = $aggregations;
  86. return $this;
  87. }
  88. /**
  89. * Get search criteria.
  90. *
  91. * @return \Magento\Framework\Api\SearchCriteriaInterface|null
  92. */
  93. public function getSearchCriteria()
  94. {
  95. return null;
  96. }
  97. /**
  98. * Set search criteria.
  99. *
  100. * @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria
  101. * @return $this
  102. * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  103. */
  104. public function setSearchCriteria(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria = null)
  105. {
  106. return $this;
  107. }
  108. /**
  109. * Get total count.
  110. *
  111. * @return int
  112. */
  113. public function getTotalCount()
  114. {
  115. return $this->getSize();
  116. }
  117. /**
  118. * Set total count.
  119. *
  120. * @param int $totalCount
  121. * @return $this
  122. * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  123. */
  124. public function setTotalCount($totalCount)
  125. {
  126. return $this;
  127. }
  128. /**
  129. * Set items list.
  130. *
  131. * @param \Magento\Framework\Api\ExtensibleDataInterface[] $items
  132. * @return $this
  133. * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  134. */
  135. public function setItems(array $items = null)
  136. {
  137. return $this;
  138. }
  139. }