Skip to content

Commit 9da62db

Browse files
committed
Create a _getAllIdsSelect method in the block collection
1 parent 1e9377a commit 9da62db

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,24 @@ 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+
}
81101
}

0 commit comments

Comments
 (0)