Collection.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <?php
  2. namespace Smartwave\Dailydeals\Model\ResourceModel\Dailydeal\Grid;
  3. class Collection extends \Smartwave\Dailydeals\Model\ResourceModel\Dailydeal\Collection implements \Magento\Framework\Api\Search\SearchResultInterface
  4. {
  5. /**
  6. * Aggregations
  7. *
  8. * @var \Magento\Framework\Search\AggregationInterface
  9. */
  10. protected $aggregations;
  11. /**
  12. * constructor
  13. *
  14. * @param \Magento\Framework\Data\Collection\EntityFactoryInterface $entityFactory
  15. * @param \Psr\Log\LoggerInterface $logger
  16. * @param \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy
  17. * @param \Magento\Framework\Event\ManagerInterface $eventManager
  18. * @param $mainTable
  19. * @param $eventPrefix
  20. * @param $eventObject
  21. * @param $resourceModel
  22. * @param $model
  23. * @param $connection
  24. * @param \Magento\Framework\Model\ResourceModel\Db\AbstractDb $resource
  25. */
  26. public function __construct(
  27. \Magento\Framework\Data\Collection\EntityFactoryInterface $entityFactory,
  28. \Psr\Log\LoggerInterface $logger,
  29. \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy,
  30. \Magento\Framework\Event\ManagerInterface $eventManager,
  31. $mainTable,
  32. $eventPrefix,
  33. $eventObject,
  34. $resourceModel,
  35. $model = 'Magento\Framework\View\Element\UiComponent\DataProvider\Document'
  36. ) {
  37. parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager);
  38. $this->_eventPrefix = $eventPrefix;
  39. $this->_eventObject = $eventObject;
  40. $this->_init($model, $resourceModel);
  41. $this->setMainTable($mainTable);
  42. }
  43. /**
  44. * @return \Magento\Framework\Search\AggregationInterface
  45. */
  46. public function getAggregations()
  47. {
  48. return $this->aggregations;
  49. }
  50. /**
  51. * @param \Magento\Framework\Search\AggregationInterface $aggregations
  52. * @return $this
  53. */
  54. public function setAggregations($aggregations)
  55. {
  56. $this->aggregations = $aggregations;
  57. }
  58. /**
  59. * Retrieve all ids for collection
  60. * Backward compatibility with EAV collection
  61. *
  62. * @param int $limit
  63. * @param int $offset
  64. * @return array
  65. */
  66. public function getAllIds($limit = null, $offset = null)
  67. {
  68. return $this->getConnection()->fetchCol($this->_getAllIdsSelect($limit, $offset), $this->_bindParams);
  69. }
  70. /**
  71. * Get search criteria.
  72. *
  73. * @return \Magento\Framework\Api\SearchCriteriaInterface|null
  74. */
  75. public function getSearchCriteria()
  76. {
  77. return null;
  78. }
  79. /**
  80. * Set search criteria.
  81. *
  82. * @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria
  83. * @return $this
  84. * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  85. */
  86. public function setSearchCriteria(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria = null)
  87. {
  88. return $this;
  89. }
  90. /**
  91. * Get total count.
  92. *
  93. * @return int
  94. */
  95. public function getTotalCount()
  96. {
  97. return $this->getSize();
  98. }
  99. /**
  100. * Set total count.
  101. *
  102. * @param int $totalCount
  103. * @return $this
  104. * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  105. */
  106. public function setTotalCount($totalCount)
  107. {
  108. return $this;
  109. }
  110. /**
  111. * Set items list.
  112. *
  113. * @param \Magento\Framework\Api\ExtensibleDataInterface[] $items
  114. * @return $this
  115. * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  116. */
  117. public function setItems(array $items = null)
  118. {
  119. return $this;
  120. }
  121. }