Skip to content

Commit 7b1404f

Browse files
author
Jan Petr
authored
Revert "Adding "total" to adapter queries (introduced by Magento 2.3) (#791)" (#797)
This reverts commit 7afc993.
1 parent 7afc993 commit 7b1404f

File tree

2 files changed

+1
-31
lines changed

2 files changed

+1
-31
lines changed

Adapter/Algolia.php

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
use AlgoliaSearch\AlgoliaConnectionException;
77
use Magento\Framework\App\ResourceConnection;
88
use Magento\Framework\DB\Ddl\Table;
9-
use Magento\Framework\DB\Select;
109
use Magento\Framework\Search\Adapter\Mysql\Aggregation\Builder as AggregationBuilder;
1110
use Magento\Framework\Search\Adapter\Mysql\DocumentFactory;
1211
use Magento\Framework\Search\Adapter\Mysql\Mapper;
@@ -41,11 +40,6 @@ class Algolia implements AdapterInterface
4140
/** @var DocumentFactory */
4241
private $documentFactory;
4342

44-
private $countSqlSkipParts = [
45-
\Magento\Framework\DB\Select::LIMIT_COUNT => true,
46-
\Magento\Framework\DB\Select::LIMIT_OFFSET => true,
47-
];
48-
4943
/**
5044
* @param Mapper $mapper
5145
* @param ResponseFactory $responseFactory
@@ -109,7 +103,6 @@ public function query(RequestInterface $request)
109103
$response = [
110104
'documents' => $documents,
111105
'aggregations' => $aggregations,
112-
'total' => 0,
113106
];
114107

115108
return $this->responseFactory->create($response);
@@ -127,7 +120,6 @@ private function nativeQuery(RequestInterface $request)
127120
$response = [
128121
'documents' => $documents,
129122
'aggregations' => $aggregations,
130-
'total' => $this->getSize($query),
131123
];
132124

133125
return $this->responseFactory->create($response);
@@ -138,29 +130,6 @@ private function getApiDocument($document)
138130
return $this->documentFactory->create($document);
139131
}
140132

141-
private function getSize(Select $query)
142-
{
143-
$sql = $this->getSelectCountSql($query);
144-
$parentSelect = $this->getConnection()->select();
145-
$parentSelect->from(['core_select' => $sql]);
146-
$parentSelect->reset(\Magento\Framework\DB\Select::COLUMNS);
147-
$parentSelect->columns('COUNT(*)');
148-
$totalRecords = $this->getConnection()->fetchOne($parentSelect);
149-
150-
return intval($totalRecords);
151-
}
152-
153-
private function getSelectCountSql(Select $query)
154-
{
155-
foreach ($this->countSqlSkipParts as $part => $toSkip) {
156-
if ($toSkip) {
157-
$query->reset($part);
158-
}
159-
}
160-
161-
return $query;
162-
}
163-
164133
/**
165134
* Executes query and return raw response
166135
*

Model/Observer/CatalogPermissions/ProductCollectionAddPermissions.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ protected function addProductPermissionsData($additionalData, $productIds, $stor
6565
foreach ($permissions as $permission) {
6666
list($permissionStoreId, $customerGroupId, $level) = explode('_', $permission);
6767
if ($permissionStoreId == $storeId) {
68+
6869
$additionalData->addProductData($productId, [
6970
'customer_group_permission_' . $customerGroupId => (($level == -2 || $level != -1
7071
&& !$catalogPermissionsHelper->isAllowedCategoryView()) ? 0 : 1),

0 commit comments

Comments
 (0)