Collection.php 3.8 KB

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