Collection.php 4.0 KB

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