Skip to content

Commit bcec2f5

Browse files
committed
Merge remote-tracking branch 'origin/2.3-develop' into MAGETWO-90113
# Conflicts: # dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/CheckoutShippingMethodsSection.xml # dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Page/AdminEditCustomerPage.xml # dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Page/StorefrontCustomerOrderPage.xml # dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Section/StorefrontCustomerOrderViewSection.xml # dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Test/AdminCreateCustomerTest.xml
2 parents 9f81702 + 48b9318 commit bcec2f5

File tree

362 files changed

+11006
-2184
lines changed

Some content is hidden

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

362 files changed

+11006
-2184
lines changed

README.md

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,15 @@
33
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/magento/magento2?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
44
[![Crowdin](https://d322cqt584bo4o.cloudfront.net/magento-2/localized.png)](https://crowdin.com/project/magento-2)
55
<h2>Welcome</h2>
6-
Welcome to Magento 2 installation! We're glad you chose to install Magento 2, a cutting edge, feature-rich eCommerce solution that gets results.
6+
Welcome to Magento 2 installation! We're glad you chose to install Magento 2, a cutting-edge, feature-rich eCommerce solution that gets results.
77

88
## Magento system requirements
9-
[Magento system requirements](http://devdocs.magento.com/guides/v2.2/install-gde/system-requirements2.html)
9+
[Magento system requirements](http://devdocs.magento.com/guides/v2.3/install-gde/system-requirements2.html)
1010

1111
## Install Magento
1212
To install Magento, see either:
1313

14-
* [Magento DevBox](https://magento.com/tech-resources/download), the easiest way to get started with Magento.
15-
* [Installation guide](http://devdocs.magento.com/guides/v2.2/install-gde/bk-install-guide.html)
14+
* [Installation guide](http://devdocs.magento.com/guides/v2.3/install-gde/bk-install-guide.html)
1615

1716
<h2>Contributing to the Magento 2 code base</h2>
1817
Contributions can take the form of new components or features, changes to existing features, tests, documentation (such as developer guides, user guides, examples, or specifications), bug fixes, optimizations, or just good suggestions.
@@ -23,11 +22,24 @@ To learn about issues, click [here][2]. To open an issue, click [here][3].
2322

2423
To suggest documentation improvements, click [here][4].
2524

26-
[1]: <http://devdocs.magento.com/guides/v2.2/contributor-guide/contributing.html>
27-
[2]: <http://devdocs.magento.com/guides/v2.2/contributor-guide/contributing.html#report>
25+
[1]: <http://devdocs.magento.com/guides/v2.3/contributor-guide/contributing.html>
26+
[2]: <http://devdocs.magento.com/guides/v2.3/contributor-guide/contributing.html#report>
2827
[3]: <https://github.com/magento/magento2/issues>
2928
[4]: <http://devdocs.magento.com>
3029

30+
<h3>Community Maintainers</h3>
31+
The members of this team have been recognized for their outstanding commitment to maintaining and improving Magento. Magento has granted them permission to accept, merge, and reject pull requests, as well as review issues, and thanks these Community Maintainers for their valuable contributions.
32+
33+
<a href="https://magento.com/magento-contributors#maintainers">
34+
<img src="https://raw.githubusercontent.com/wiki/magento/magento2/images/maintainers.png"/>
35+
</a>
36+
37+
<h3>Top Contributors</h3>
38+
Magento is thankful for any contribution that can improve our code base, documentation or increase test coverage. We always recognize our most active members, as their contributions are the foundation of the Magento Open Source platform.
39+
<a href="https://magento.com/magento-contributors">
40+
<img src="https://raw.githubusercontent.com/wiki/magento/magento2/images/contributors.png"/>
41+
</a>
42+
3143
<h3>Labels applied by the Magento team</h3>
3244

3345
| Label | Description |

app/code/Magento/Backend/Model/Url.php

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -202,33 +202,36 @@ public function getUrl($routePath = null, $routeParams = null)
202202
}
203203

204204
$cacheSecretKey = false;
205-
if (is_array($routeParams) && isset($routeParams['_cache_secret_key'])) {
205+
if (isset($routeParams['_cache_secret_key'])) {
206206
unset($routeParams['_cache_secret_key']);
207207
$cacheSecretKey = true;
208208
}
209209
$result = parent::getUrl($routePath, $routeParams);
210210
if (!$this->useSecretKey()) {
211211
return $result;
212212
}
213+
214+
$this->getRouteParamsResolver()->unsetData('route_params');
213215
$this->_setRoutePath($routePath);
216+
$extraParams = $this->getRouteParamsResolver()->getRouteParams();
214217
$routeName = $this->_getRouteName('*');
215218
$controllerName = $this->_getControllerName(self::DEFAULT_CONTROLLER_NAME);
216219
$actionName = $this->_getActionName(self::DEFAULT_ACTION_NAME);
217-
if ($cacheSecretKey) {
218-
$secret = [self::SECRET_KEY_PARAM_NAME => "\${$routeName}/{$controllerName}/{$actionName}\$"];
219-
} else {
220-
$secret = [
221-
self::SECRET_KEY_PARAM_NAME => $this->getSecretKey($routeName, $controllerName, $actionName),
222-
];
223-
}
224-
if (is_array($routeParams)) {
225-
$routeParams = array_merge($secret, $routeParams);
226-
} else {
227-
$routeParams = $secret;
220+
221+
if (!isset($routeParams[self::SECRET_KEY_PARAM_NAME])) {
222+
if (!is_array($routeParams)) {
223+
$routeParams = [];
224+
}
225+
$secretKey = $cacheSecretKey
226+
? "\${$routeName}/{$controllerName}/{$actionName}\$"
227+
: $this->getSecretKey($routeName, $controllerName, $actionName);
228+
$routeParams[self::SECRET_KEY_PARAM_NAME] = $secretKey;
228229
}
229-
if (is_array($this->_getRouteParams())) {
230-
$routeParams = array_merge($this->_getRouteParams(), $routeParams);
230+
231+
if (!empty($extraParams)) {
232+
$routeParams = array_merge($extraParams, $routeParams);
231233
}
234+
232235
return parent::getUrl("{$routeName}/{$controllerName}/{$actionName}", $routeParams);
233236
}
234237

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Catalog\Model\Api\SearchCriteria\CollectionProcessor\ConditionProcessor\ConditionBuilder;
9+
10+
use Magento\Framework\Api\SearchCriteria\CollectionProcessor\ConditionProcessor\CustomConditionInterface;
11+
use Magento\Framework\Api\Filter;
12+
use Magento\Catalog\Model\ResourceModel\Product\Collection;
13+
use Magento\Catalog\Model\ResourceModel\Eav\Attribute;
14+
15+
/**
16+
* Based on Magento\Framework\Api\Filter builds condition
17+
* that can be applied to Catalog\Model\ResourceModel\Product\Collection
18+
* to filter products that has specific value for EAV attribute
19+
*/
20+
class EavAttributeCondition implements CustomConditionInterface
21+
{
22+
/**
23+
* @var \Magento\Framework\App\ResourceConnection
24+
*/
25+
private $resourceConnection;
26+
27+
/**
28+
* @var \Magento\Eav\Model\Config
29+
*/
30+
private $eavConfig;
31+
32+
/**
33+
* @param \Magento\Eav\Model\Config $eavConfig
34+
* @param \Magento\Framework\App\ResourceConnection $resourceConnection
35+
*/
36+
public function __construct(
37+
\Magento\Eav\Model\Config $eavConfig,
38+
\Magento\Framework\App\ResourceConnection $resourceConnection
39+
) {
40+
$this->eavConfig = $eavConfig;
41+
$this->resourceConnection = $resourceConnection;
42+
}
43+
44+
/**
45+
* Build condition to filter product collection by EAV attribute
46+
*
47+
* @param Filter $filter
48+
* @return string
49+
* @throws \DomainException
50+
* @throws \Magento\Framework\Exception\LocalizedException
51+
*/
52+
public function build(Filter $filter): string
53+
{
54+
$attribute = $this->getAttributeByCode($filter->getField());
55+
$tableAlias = 'ca_' . $attribute->getAttributeCode();
56+
57+
$conditionType = $this->mapConditionType($filter->getConditionType());
58+
$conditionValue = $this->mapConditionValue($conditionType, $filter->getValue());
59+
60+
// NOTE: store scope was ignored intentionally to perform search across all stores
61+
$attributeSelect = $this->resourceConnection->getConnection()
62+
->select()
63+
->from(
64+
[$tableAlias => $attribute->getBackendTable()],
65+
$tableAlias . '.' . $attribute->getEntityIdField()
66+
)->where(
67+
$this->resourceConnection->getConnection()->prepareSqlCondition(
68+
$tableAlias . '.' . $attribute->getIdFieldName(),
69+
['eq' => $attribute->getAttributeId()]
70+
)
71+
)->where(
72+
$this->resourceConnection->getConnection()->prepareSqlCondition(
73+
$tableAlias . '.value',
74+
[$conditionType => $conditionValue]
75+
)
76+
);
77+
78+
return $this->resourceConnection
79+
->getConnection()
80+
->prepareSqlCondition(
81+
Collection::MAIN_TABLE_ALIAS . '.' . $attribute->getEntityIdField(),
82+
[
83+
'in' => $attributeSelect
84+
]
85+
);
86+
}
87+
88+
/**
89+
* @param string $field
90+
* @return Attribute
91+
* @throws \Magento\Framework\Exception\LocalizedException
92+
*/
93+
private function getAttributeByCode(string $field): Attribute
94+
{
95+
return $this->eavConfig->getAttribute(\Magento\Catalog\Model\Product::ENTITY, $field);
96+
}
97+
98+
/**
99+
* Map equal and not equal conditions to in and not in
100+
*
101+
* @param string $conditionType
102+
* @return mixed
103+
*/
104+
private function mapConditionType(string $conditionType): string
105+
{
106+
$conditionsMap = [
107+
'eq' => 'in',
108+
'neq' => 'nin'
109+
];
110+
111+
return isset($conditionsMap[$conditionType]) ? $conditionsMap[$conditionType] : $conditionType;
112+
}
113+
114+
/**
115+
* Wraps value with '%' if condition type is 'like' or 'not like'
116+
*
117+
* @param string $conditionType
118+
* @param string $conditionValue
119+
* @return string
120+
*/
121+
private function mapConditionValue(string $conditionType, string $conditionValue): string
122+
{
123+
$conditionsMap = ['like', 'nlike'];
124+
125+
if (in_array($conditionType, $conditionsMap)) {
126+
$conditionValue = '%' . $conditionValue . '%';
127+
}
128+
129+
return $conditionValue;
130+
}
131+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Catalog\Model\Api\SearchCriteria\CollectionProcessor\ConditionProcessor\ConditionBuilder;
9+
10+
use Magento\Framework\Api\Filter;
11+
use Magento\Framework\Api\SearchCriteria\CollectionProcessor\ConditionProcessor\CustomConditionInterface;
12+
use Magento\Catalog\Model\ResourceModel\Eav\Attribute;
13+
14+
/**
15+
* Creates appropriate condition builder based on filter field
16+
* - native attribute condition builder if filter field is native attribute in product
17+
* - eav condition builder if filter field is eav attribute
18+
*/
19+
class Factory
20+
{
21+
/**
22+
* @var \Magento\Eav\Model\Config
23+
*/
24+
private $eavConfig;
25+
26+
/**
27+
* @var \Magento\Catalog\Model\ResourceModel\Product
28+
*/
29+
private $productResource;
30+
31+
/**
32+
* @var CustomConditionInterface
33+
*/
34+
private $eavAttributeConditionBuilder;
35+
36+
/**
37+
* @var CustomConditionInterface
38+
*/
39+
private $nativeAttributeConditionBuilder;
40+
41+
/**
42+
* @param \Magento\Eav\Model\Config $eavConfig
43+
* @param \Magento\Catalog\Model\ResourceModel\Product $productResource
44+
* @param CustomConditionInterface $eavAttributeConditionBuilder
45+
* @param CustomConditionInterface $nativeAttributeConditionBuilder
46+
*/
47+
public function __construct(
48+
\Magento\Eav\Model\Config $eavConfig,
49+
\Magento\Catalog\Model\ResourceModel\Product $productResource,
50+
CustomConditionInterface $eavAttributeConditionBuilder,
51+
CustomConditionInterface $nativeAttributeConditionBuilder
52+
) {
53+
$this->eavConfig = $eavConfig;
54+
$this->productResource = $productResource;
55+
$this->eavAttributeConditionBuilder = $eavAttributeConditionBuilder;
56+
$this->nativeAttributeConditionBuilder = $nativeAttributeConditionBuilder;
57+
}
58+
59+
/**
60+
* Decides which condition builder should be used for passed filter
61+
* can be either EAV attribute builder or native attribute builder
62+
* "native" attribute means attribute that is in catalog_product_entity table
63+
*
64+
* @param Filter $filter
65+
* @return CustomConditionInterface
66+
* @throws \Magento\Framework\Exception\LocalizedException
67+
*/
68+
public function createByFilter(Filter $filter): CustomConditionInterface
69+
{
70+
$attribute = $this->getAttributeByCode($filter->getField());
71+
72+
if ($attribute->getBackendTable() === $this->productResource->getEntityTable()) {
73+
return $this->nativeAttributeConditionBuilder;
74+
}
75+
76+
return $this->eavAttributeConditionBuilder;
77+
}
78+
79+
/**
80+
* @param string $field
81+
* @return \Magento\Catalog\Model\ResourceModel\Eav\Attribute
82+
* @throws \Magento\Framework\Exception\LocalizedException
83+
*/
84+
private function getAttributeByCode(string $field): Attribute
85+
{
86+
return $this->eavConfig->getAttribute(\Magento\Catalog\Model\Product::ENTITY, $field);
87+
}
88+
}

0 commit comments

Comments
 (0)