Skip to content

Commit af16a56

Browse files
committed
Move _getAllIdsSelect into the grid collection
1 parent 9da62db commit af16a56

File tree

2 files changed

+21
-20
lines changed

2 files changed

+21
-20
lines changed

app/code/Magento/Cms/Model/ResourceModel/Block/Collection.php

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -78,24 +78,4 @@ protected function _renderFiltersBefore()
7878
$entityMetadata = $this->metadataPool->getMetadata(BlockInterface::class);
7979
$this->joinStoreRelationTable('cms_block_store', $entityMetadata->getLinkField());
8080
}
81-
82-
/**
83-
* Create all ids retrieving select with limitation
84-
* Backward compatibility with EAV collection
85-
*
86-
* @param int $limit
87-
* @param int $offset
88-
* @return \Magento\Eav\Model\Entity\Collection\AbstractCollection
89-
*/
90-
protected function _getAllIdsSelect($limit = null, $offset = null)
91-
{
92-
$idsSelect = clone $this->getSelect();
93-
$idsSelect->reset(\Magento\Framework\DB\Select::ORDER);
94-
$idsSelect->reset(\Magento\Framework\DB\Select::LIMIT_COUNT);
95-
$idsSelect->reset(\Magento\Framework\DB\Select::LIMIT_OFFSET);
96-
$idsSelect->reset(\Magento\Framework\DB\Select::COLUMNS);
97-
$idsSelect->columns($this->getResource()->getIdFieldName(), 'main_table');
98-
$idsSelect->limit($limit, $offset);
99-
return $idsSelect;
100-
}
10181
}

app/code/Magento/Cms/Model/ResourceModel/Block/Grid/Collection.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,33 @@ public function setAggregations($aggregations)
9191
* @param int $limit
9292
* @param int $offset
9393
* @return array
94+
* @throws \Magento\Framework\Exception\LocalizedException
9495
*/
9596
public function getAllIds($limit = null, $offset = null)
9697
{
9798
return $this->getConnection()->fetchCol($this->_getAllIdsSelect($limit, $offset), $this->_bindParams);
9899
}
99100

101+
/**
102+
* Create all ids retrieving select with limitation
103+
*
104+
* @param int $limit
105+
* @param int $offset
106+
* @return \Magento\Framework\DB\Select
107+
* @throws \Magento\Framework\Exception\LocalizedException
108+
*/
109+
protected function _getAllIdsSelect($limit = null, $offset = null)
110+
{
111+
$idsSelect = clone $this->getSelect();
112+
$idsSelect->reset(\Magento\Framework\DB\Select::ORDER);
113+
$idsSelect->reset(\Magento\Framework\DB\Select::LIMIT_COUNT);
114+
$idsSelect->reset(\Magento\Framework\DB\Select::LIMIT_OFFSET);
115+
$idsSelect->reset(\Magento\Framework\DB\Select::COLUMNS);
116+
$idsSelect->columns($this->getResource()->getIdFieldName(), 'main_table');
117+
$idsSelect->limit($limit, $offset);
118+
return $idsSelect;
119+
}
120+
100121
/**
101122
* Get search criteria.
102123
*

0 commit comments

Comments
 (0)