Collection.php 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Review\Model\ResourceModel\Rating\Grid;
  7. /**
  8. * Rating grid collection
  9. *
  10. * @author Magento Core Team <core@magentocommerce.com>
  11. */
  12. class Collection extends \Magento\Review\Model\ResourceModel\Rating\Collection
  13. {
  14. /**
  15. * Core registry
  16. *
  17. * @var \Magento\Framework\Registry
  18. */
  19. protected $_coreRegistry = null;
  20. /**
  21. * @param \Magento\Framework\Data\Collection\EntityFactory $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\Review\Model\ResourceModel\Rating\Option\CollectionFactory $ratingCollectionF
  27. * @param \Magento\Framework\Registry $coreRegistry
  28. * @param mixed $connection
  29. * @param \Magento\Framework\Model\ResourceModel\Db\AbstractDb $resource
  30. */
  31. public function __construct(
  32. \Magento\Framework\Data\Collection\EntityFactory $entityFactory,
  33. \Psr\Log\LoggerInterface $logger,
  34. \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy,
  35. \Magento\Framework\Event\ManagerInterface $eventManager,
  36. \Magento\Store\Model\StoreManagerInterface $storeManager,
  37. \Magento\Review\Model\ResourceModel\Rating\Option\CollectionFactory $ratingCollectionF,
  38. \Magento\Framework\Registry $coreRegistry,
  39. \Magento\Framework\DB\Adapter\AdapterInterface $connection = null,
  40. \Magento\Framework\Model\ResourceModel\Db\AbstractDb $resource = null
  41. ) {
  42. $this->_coreRegistry = $coreRegistry;
  43. parent::__construct(
  44. $entityFactory,
  45. $logger,
  46. $fetchStrategy,
  47. $eventManager,
  48. $storeManager,
  49. $ratingCollectionF,
  50. $connection,
  51. $resource
  52. );
  53. }
  54. /**
  55. * Add entity filter
  56. *
  57. * @return $this
  58. */
  59. public function _initSelect()
  60. {
  61. parent::_initSelect();
  62. $this->addEntityFilter($this->_coreRegistry->registry('entityId'));
  63. return $this;
  64. }
  65. }