Collection.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Cms\Model\ResourceModel\Block\Grid;
  7. use Magento\Framework\Api\Search\SearchResultInterface;
  8. use Magento\Framework\Api\Search\AggregationInterface;
  9. use Magento\Cms\Model\ResourceModel\Block\Collection as BlockCollection;
  10. /**
  11. * Collection for displaying grid of cms blocks
  12. */
  13. class Collection extends BlockCollection implements SearchResultInterface
  14. {
  15. /**
  16. * @var AggregationInterface
  17. */
  18. protected $aggregations;
  19. /**
  20. * @param \Magento\Framework\Data\Collection\EntityFactoryInterface $entityFactory
  21. * @param \Psr\Log\LoggerInterface $logger
  22. * @param \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy
  23. * @param \Magento\Framework\Event\ManagerInterface $eventManager
  24. * @param \Magento\Store\Model\StoreManagerInterface $storeManager
  25. * @param \Magento\Framework\EntityManager\MetadataPool $metadataPool
  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. \Magento\Store\Model\StoreManagerInterface $storeManager,
  42. \Magento\Framework\EntityManager\MetadataPool $metadataPool,
  43. $mainTable,
  44. $eventPrefix,
  45. $eventObject,
  46. $resourceModel,
  47. $model = \Magento\Framework\View\Element\UiComponent\DataProvider\Document::class,
  48. $connection = null,
  49. \Magento\Framework\Model\ResourceModel\Db\AbstractDb $resource = null
  50. ) {
  51. parent::__construct(
  52. $entityFactory,
  53. $logger,
  54. $fetchStrategy,
  55. $eventManager,
  56. $storeManager,
  57. $metadataPool,
  58. $connection,
  59. $resource
  60. );
  61. $this->_eventPrefix = $eventPrefix;
  62. $this->_eventObject = $eventObject;
  63. $this->_init($model, $resourceModel);
  64. $this->setMainTable($mainTable);
  65. }
  66. /**
  67. * @return AggregationInterface
  68. */
  69. public function getAggregations()
  70. {
  71. return $this->aggregations;
  72. }
  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. }