Collection.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Eav\Model\ResourceModel\Entity\Attribute\Grid;
  7. use Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection;
  8. /**
  9. * Eav Resource Attribute Set Collection
  10. *
  11. * @author Magento Core Team <core@magentocommerce.com>
  12. */
  13. class Collection extends \Magento\Eav\Model\ResourceModel\Entity\Attribute\Set\Collection
  14. {
  15. /**
  16. * @var \Magento\Framework\Registry
  17. */
  18. protected $_registryManager;
  19. /**
  20. * @param \Magento\Framework\Data\Collection\EntityFactory $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\Framework\Registry $registryManager
  25. * @param mixed $connection
  26. * @param \Magento\Framework\Model\ResourceModel\Db\AbstractDb $resource
  27. * @codeCoverageIgnore
  28. */
  29. public function __construct(
  30. \Magento\Framework\Data\Collection\EntityFactory $entityFactory,
  31. \Psr\Log\LoggerInterface $logger,
  32. \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy,
  33. \Magento\Framework\Event\ManagerInterface $eventManager,
  34. \Magento\Framework\Registry $registryManager,
  35. \Magento\Framework\DB\Adapter\AdapterInterface $connection = null,
  36. \Magento\Framework\Model\ResourceModel\Db\AbstractDb $resource = null
  37. ) {
  38. $this->_registryManager = $registryManager;
  39. parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource);
  40. }
  41. /**
  42. * Add filter by entity type id to collection
  43. *
  44. * @return \Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection|$this
  45. */
  46. protected function _initSelect()
  47. {
  48. parent::_initSelect();
  49. $this->setEntityTypeFilter($this->_registryManager->registry('entityType'));
  50. return $this;
  51. }
  52. }