Skip to content

Commit 154503c

Browse files
committed
Merge branch 'sw-26336/5.7/fix-es-indexing' into '5.7'
SW-26336 - Fix ES indexing query skipping property groups See merge request shopware/5/product/shopware!651
2 parents 8cfd52d + 6d1377d commit 154503c

File tree

3 files changed

+60
-1
lines changed

3 files changed

+60
-1
lines changed

engine/Shopware/Bundle/ESIndexingBundle/LastIdQuery.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function fetchCount()
6969
}
7070

7171
/**
72-
* @deprecated in 5.6, will be removed in 5.7 without replacement
72+
* @deprecated in 5.6, will be removed in 5.8 without replacement
7373
*
7474
* @return QueryBuilder
7575
*/

engine/Shopware/Bundle/ESIndexingBundle/Property/PropertyQueryFactory.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ private function createOptionQuery($limit = null)
6060
$query->select(['propertyGroups.id', 'propertyGroups.id'])
6161
->from('s_filter_options', 'propertyGroups')
6262
->where('propertyGroups.id > :lastId')
63+
->orderBy('propertyGroups.id', 'ASC')
6364
->setParameter(':lastId', 0);
6465

6566
if ($limit !== null) {
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
/**
5+
* Shopware 5
6+
* Copyright (c) shopware AG
7+
*
8+
* According to our dual licensing model, this program can be used either
9+
* under the terms of the GNU Affero General Public License, version 3,
10+
* or under a proprietary license.
11+
*
12+
* The texts of the GNU Affero General Public License with an additional
13+
* permission and of our proprietary license can be found at and
14+
* in the LICENSE file you have received along with this program.
15+
*
16+
* This program is distributed in the hope that it will be useful,
17+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19+
* GNU Affero General Public License for more details.
20+
*
21+
* "Shopware" is a registered trademark of shopware AG.
22+
* The licensing of the program under the AGPLv3 does not imply a
23+
* trademark license. Therefore any rights, title and interest in
24+
* our trademarks remain entirely with us.
25+
*/
26+
27+
namespace Shopware\Tests\Functional\Bundle\ESIndexingBundle\Property;
28+
29+
use Doctrine\DBAL\Connection;
30+
use Doctrine\DBAL\Query\QueryBuilder;
31+
use PHPUnit\Framework\TestCase;
32+
use Shopware\Bundle\ESIndexingBundle\Property\PropertyQueryFactory;
33+
use Shopware\Tests\Functional\Traits\ContainerTrait;
34+
35+
class PropertyQueryFactoryTest extends TestCase
36+
{
37+
use ContainerTrait;
38+
39+
public function testCreateQueryShouldContainOrderByPropertyGroups(): void
40+
{
41+
$queryBuilderMock = $this->getMockBuilder(QueryBuilder::class)
42+
->disableOriginalConstructor()
43+
->onlyMethods(['orderBy'])
44+
->getMock();
45+
46+
$queryBuilderMock
47+
->expects(static::once())
48+
->method('orderBy')
49+
->with('propertyGroups.id', 'ASC')
50+
->willReturn($queryBuilderMock);
51+
52+
$connection = $this->createConfiguredMock(Connection::class, ['createQueryBuilder' => $queryBuilderMock]);
53+
54+
$propertyFactory = new PropertyQueryFactory($connection);
55+
56+
$propertyFactory->createQuery(20);
57+
}
58+
}

0 commit comments

Comments
 (0)