Skip to content

Commit b7165b9

Browse files
committed
Merge remote-tracking branch 'origin/2.4-develop' into refactor/mftf-customer
# Conflicts: # app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontCustomerLogoutActionGroup.xml # app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxQuoteCheckoutTest.xml
2 parents df511be + 4dfb6da commit b7165b9

File tree

643 files changed

+19565
-4446
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

643 files changed

+19565
-4446
lines changed

README.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
1-
[![Open Source Helpers](https://www.codetriage.com/magento/magento2/badges/users.svg)](https://www.codetriage.com/magento/magento2)
2-
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/magento/magento2?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
3-
[![Crowdin](https://d322cqt584bo4o.cloudfront.net/magento-2/localized.svg)](https://crowdin.com/project/magento-2)
1+
<p align="center">
2+
<a href="https://magento.com">
3+
<img src="https://static.magento.com/sites/all/themes/magento/logo.svg" width="300px" alt="Magento" />
4+
</a>
5+
</p>
6+
<p align="center">
7+
<br /><br />
8+
<a href="https://www.codetriage.com/magento/magento2">
9+
<img src="https://www.codetriage.com/magento/magento2/badges/users.svg" alt="Open Source Helpers" />
10+
</a>
11+
<a href="https://gitter.im/magento/magento2?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge">
12+
<img src="https://badges.gitter.im/Join%20Chat.svg" alt="Gitter" />
13+
</a>
14+
<a href="https://crowdin.com/project/magento-2">
15+
<img src="https://d322cqt584bo4o.cloudfront.net/magento-2/localized.svg" alt="Crowdin" />
16+
</a>
17+
</p>
418

519
## Welcome
620
Welcome to Magento 2 installation! We're glad you chose to install Magento 2, a cutting-edge, feature-rich eCommerce solution that gets results.

app/code/Magento/Analytics/ReportXml/QueryFactory.php

Lines changed: 50 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,18 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
67
namespace Magento\Analytics\ReportXml;
78

89
use Magento\Analytics\ReportXml\DB\SelectBuilderFactory;
910
use Magento\Framework\App\CacheInterface;
11+
use Magento\Framework\DB\Select;
1012
use Magento\Framework\ObjectManagerInterface;
13+
use Magento\Framework\Serialize\Serializer\Json;
1114

1215
/**
1316
* Creates Query object according to configuration
17+
*
1418
* Factory for @see \Magento\Analytics\ReportXml\Query
1519
*/
1620
class QueryFactory
@@ -45,6 +49,11 @@ class QueryFactory
4549
*/
4650
private $selectHydrator;
4751

52+
/**
53+
* @var Json
54+
*/
55+
private $jsonSerializer;
56+
4857
/**
4958
* QueryFactory constructor.
5059
*
@@ -54,21 +63,24 @@ class QueryFactory
5463
* @param SelectBuilderFactory $selectBuilderFactory
5564
* @param Config $config
5665
* @param array $assemblers
66+
* @param Json $jsonSerializer
5767
*/
5868
public function __construct(
5969
CacheInterface $queryCache,
6070
SelectHydrator $selectHydrator,
6171
ObjectManagerInterface $objectManager,
6272
SelectBuilderFactory $selectBuilderFactory,
6373
Config $config,
64-
array $assemblers
74+
array $assemblers,
75+
Json $jsonSerializer
6576
) {
6677
$this->config = $config;
6778
$this->selectBuilderFactory = $selectBuilderFactory;
6879
$this->assemblers = $assemblers;
6980
$this->queryCache = $queryCache;
7081
$this->objectManager = $objectManager;
7182
$this->selectHydrator = $selectHydrator;
83+
$this->jsonSerializer = $jsonSerializer;
7284
}
7385

7486
/**
@@ -101,14 +113,10 @@ private function constructQuery($queryName)
101113
$selectBuilder = $assembler->assemble($selectBuilder, $queryConfig);
102114
}
103115
$select = $selectBuilder->create();
104-
return $this->objectManager->create(
105-
Query::class,
106-
[
107-
'select' => $select,
108-
'selectHydrator' => $this->selectHydrator,
109-
'connectionName' => $selectBuilder->getConnectionName(),
110-
'config' => $queryConfig
111-
]
116+
return $this->createQueryObject(
117+
$select,
118+
$selectBuilder->getConnectionName(),
119+
$queryConfig
112120
);
113121
}
114122

@@ -122,19 +130,42 @@ public function create($queryName)
122130
{
123131
$cached = $this->queryCache->load($queryName);
124132
if ($cached) {
125-
$queryData = json_decode($cached, true);
126-
return $this->objectManager->create(
127-
Query::class,
128-
[
129-
'select' => $this->selectHydrator->recreate($queryData['select_parts']),
130-
'selectHydrator' => $this->selectHydrator,
131-
'connectionName' => $queryData['connectionName'],
132-
'config' => $queryData['config']
133-
]
133+
$queryData = $this->jsonSerializer->unserialize($cached);
134+
return $this->createQueryObject(
135+
$this->selectHydrator->recreate($queryData['select_parts']),
136+
$queryData['connectionName'],
137+
$queryData['config']
134138
);
135139
}
136140
$query = $this->constructQuery($queryName);
137-
$this->queryCache->save(json_encode($query), $queryName);
141+
$this->queryCache->save(
142+
$this->jsonSerializer->serialize($query),
143+
$queryName
144+
);
138145
return $query;
139146
}
147+
148+
/**
149+
* Create query class using objectmanger
150+
*
151+
* @param Select $select
152+
* @param string $connection
153+
* @param array $queryConfig
154+
* @return Query
155+
*/
156+
private function createQueryObject(
157+
Select $select,
158+
string $connection,
159+
array $queryConfig
160+
) {
161+
return $this->objectManager->create(
162+
Query::class,
163+
[
164+
'select' => $select,
165+
'selectHydrator' => $this->selectHydrator,
166+
'connectionName' => $connection,
167+
'config' => $queryConfig
168+
]
169+
);
170+
}
140171
}

0 commit comments

Comments
 (0)