Skip to content

Commit 9aa84ed

Browse files
author
Dmytro Yushkin
committed
Merge branch 'develop' of github.com:magento/magento2ce into MPI-bugfixes
2 parents 3ce8f20 + 3bcc1c9 commit 9aa84ed

File tree

452 files changed

+16720
-4562
lines changed

Some content is hidden

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

452 files changed

+16720
-4562
lines changed

app/code/Magento/Backend/Model/View/Result/Redirect.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Magento\Backend\Model\UrlInterface;
1111
use Magento\Framework\App;
1212
use Magento\Framework\App\ActionFlag;
13+
use Magento\Framework\App\Response\HttpInterface as HttpResponseInterface;
1314

1415
class Redirect extends \Magento\Framework\Controller\Result\Redirect
1516
{
@@ -56,7 +57,7 @@ public function setRefererOrBaseUrl()
5657
/**
5758
* {@inheritdoc}
5859
*/
59-
protected function render(App\ResponseInterface $response)
60+
protected function render(HttpResponseInterface $response)
6061
{
6162
$this->session->setIsUrlNotice($this->actionFlag->get('', AbstractAction::FLAG_IS_URLS_CHECKED));
6263
return parent::render($response);

app/code/Magento/Backend/view/adminhtml/ui_component/design_config_form.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@
6969
<item name="fit" xsi:type="boolean">false</item>
7070
<item name="label" xsi:type="string">Search String</item>
7171
<item name="showFallbackReset" xsi:type="boolean">false</item>
72+
<item name="validation" xsi:type="array">
73+
<item name="required-entry" xsi:type="boolean">true</item>
74+
</item>
7275
</item>
7376
</argument>
7477
</field>
@@ -82,6 +85,9 @@
8285
<item name="fit" xsi:type="boolean">false</item>
8386
<item name="label" xsi:type="string">Theme Name</item>
8487
<item name="showFallbackReset" xsi:type="boolean">false</item>
88+
<item name="validation" xsi:type="array">
89+
<item name="required-entry" xsi:type="boolean">true</item>
90+
</item>
8591
</item>
8692
</argument>
8793
</field>

app/code/Magento/Backend/view/adminhtml/web/template/dynamic-rows/cells/action-delete.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@
1111
title: $parent.deleteButtonLabel
1212
}
1313
">
14-
<span data-bind="text: $parent.deleteButtonLabel"></span>
14+
<span translate="$parent.deleteButtonLabel"></span>
1515
</button>

app/code/Magento/Backend/view/adminhtml/web/template/dynamic-rows/grid.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
class="action-secondary"
1717
type="button"
1818
click="processingAddChild.bind($data, false, false, false)">
19-
<span text="addButtonLabel"/>
19+
<span translate="addButtonLabel"/>
2020
</button>
2121
</div>
2222

@@ -30,7 +30,7 @@
3030
css="element.setClasses(element)"
3131
attr="'data-index': index">
3232
<label if="element.label" class="admin__field-label" attr="for: element.uid">
33-
<span text="element.label"/>
33+
<span translate="element.label"/>
3434
</label>
3535

3636
<div class="admin__field-control" data-role="grid-wrapper">
@@ -51,7 +51,7 @@
5151

5252
<th repeat="foreach: labels, item: '$label'"
5353
class="data-grid-th"
54-
text="$label().label"
54+
translate="$label().label"
5555
visible="$label().visible"
5656
disable="$label().disabled"
5757
css="setClasses($label())">

app/code/Magento/Braintree/Gateway/Command/CaptureStrategyCommand.php

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -166,16 +166,25 @@ private function isExpiredAuthorization(OrderPaymentInterface $payment)
166166
*/
167167
private function isExistsCaptureTransaction(OrderPaymentInterface $payment)
168168
{
169-
$filters[] = $this->filterBuilder->setField('payment_id')
170-
->setValue($payment->getId())
171-
->create();
169+
$this->searchCriteriaBuilder->addFilters(
170+
[
171+
$this->filterBuilder
172+
->setField('payment_id')
173+
->setValue($payment->getId())
174+
->create(),
175+
]
176+
);
172177

173-
$filters[] = $this->filterBuilder->setField('txn_type')
174-
->setValue(TransactionInterface::TYPE_CAPTURE)
175-
->create();
178+
$this->searchCriteriaBuilder->addFilters(
179+
[
180+
$this->filterBuilder
181+
->setField('txn_type')
182+
->setValue(TransactionInterface::TYPE_CAPTURE)
183+
->create(),
184+
]
185+
);
176186

177-
$searchCriteria = $this->searchCriteriaBuilder->addFilters($filters)
178-
->create();
187+
$searchCriteria = $this->searchCriteriaBuilder->create();
179188

180189
$count = $this->transactionRepository->getList($searchCriteria)->getTotalCount();
181190
return (boolean) $count;

app/code/Magento/Braintree/Test/Unit/Gateway/Command/CaptureStrategyCommandTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ private function buildSearchCriteria()
374374
->willReturnSelf();
375375

376376
$searchCriteria = new SearchCriteria();
377-
$this->searchCriteriaBuilder->expects(static::once())
377+
$this->searchCriteriaBuilder->expects(static::exactly(2))
378378
->method('addFilters')
379379
->willReturnSelf();
380380
$this->searchCriteriaBuilder->expects(static::once())

app/code/Magento/Braintree/Test/Unit/Gateway/Request/VaultCaptureDataBuilderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public function testBuild()
8080
$paymentExtension = $this->getMockBuilder(OrderPaymentExtension::class)
8181
->setMethods(['getVaultPaymentToken'])
8282
->disableOriginalConstructor()
83-
->getMock();
83+
->getMockForAbstractClass();
8484

8585
$paymentToken = $this->getMockBuilder(PaymentToken::class)
8686
->disableOriginalConstructor()

app/code/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute/Save.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public function execute()
132132
$attributesData[$attributeCode] = $value;
133133
} elseif ($attribute->getFrontendInput() == 'multiselect') {
134134
// Check if 'Change' checkbox has been checked by admin for this attribute
135-
$isChanged = (bool)$this->getRequest()->getPost($attributeCode . '_checkbox');
135+
$isChanged = (bool)$this->getRequest()->getPost('toggle_' . $attributeCode);
136136
if (!$isChanged) {
137137
unset($attributesData[$attributeCode]);
138138
continue;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Catalog\Model\Api\SearchCriteria\CollectionProcessor\FilterProcessor;
7+
8+
use Magento\Catalog\Model\ResourceModel\Product\Collection;
9+
use Magento\Framework\Api\Filter;
10+
use Magento\Framework\Api\SearchCriteria\CollectionProcessor\FilterProcessor\CustomFilterInterface;
11+
use Magento\Framework\Data\Collection\AbstractDb;
12+
13+
class ProductCategoryFilter implements CustomFilterInterface
14+
{
15+
/**
16+
* Apply category_id Filter to Product Collection
17+
*
18+
* @param Filter $filter
19+
* @param AbstractDb $collection
20+
* @return bool Whether the filter is applied
21+
*/
22+
public function apply(Filter $filter, AbstractDb $collection)
23+
{
24+
$conditionType = $filter->getConditionType() ? $filter->getConditionType() : 'eq';
25+
$categoryFilter = [$conditionType => [$filter->getValue()]];
26+
27+
/** @var Collection $collection */
28+
$collection->addCategoriesFilter($categoryFilter);
29+
30+
return true;
31+
}
32+
}

app/code/Magento/Catalog/Model/CategoryList.php

Lines changed: 20 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,8 @@
1212
use Magento\Catalog\Model\ResourceModel\Category\Collection;
1313
use Magento\Catalog\Model\ResourceModel\Category\CollectionFactory;
1414
use Magento\Framework\Api\ExtensionAttribute\JoinProcessorInterface;
15-
use Magento\Framework\Api\Search\FilterGroup;
1615
use Magento\Framework\Api\SearchCriteriaInterface;
17-
use Magento\Framework\Api\SortOrder;
18-
use Magento\Framework\App\ObjectManager;
16+
use Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface;
1917

2018
class CategoryList implements CategoryListInterface
2119
{
@@ -39,22 +37,30 @@ class CategoryList implements CategoryListInterface
3937
*/
4038
private $categoryRepository;
4139

40+
/**
41+
* @var CollectionProcessorInterface
42+
*/
43+
private $collectionProcessor;
44+
4245
/**
4346
* @param CollectionFactory $categoryCollectionFactory
4447
* @param JoinProcessorInterface $extensionAttributesJoinProcessor
4548
* @param CategorySearchResultsInterfaceFactory $categorySearchResultsFactory
4649
* @param CategoryRepositoryInterface $categoryRepository
50+
* @param CollectionProcessorInterface $collectionProcessor
4751
*/
4852
public function __construct(
4953
CollectionFactory $categoryCollectionFactory,
5054
JoinProcessorInterface $extensionAttributesJoinProcessor,
5155
CategorySearchResultsInterfaceFactory $categorySearchResultsFactory,
52-
CategoryRepositoryInterface $categoryRepository
56+
CategoryRepositoryInterface $categoryRepository,
57+
CollectionProcessorInterface $collectionProcessor = null
5358
) {
5459
$this->categoryCollectionFactory = $categoryCollectionFactory;
5560
$this->extensionAttributesJoinProcessor = $extensionAttributesJoinProcessor;
5661
$this->categorySearchResultsFactory = $categorySearchResultsFactory;
5762
$this->categoryRepository = $categoryRepository;
63+
$this->collectionProcessor = $collectionProcessor ?: $this->getCollectionProcessor();
5864
}
5965

6066
/**
@@ -66,23 +72,7 @@ public function getList(SearchCriteriaInterface $searchCriteria)
6672
$collection = $this->categoryCollectionFactory->create();
6773
$this->extensionAttributesJoinProcessor->process($collection);
6874

69-
foreach ($searchCriteria->getFilterGroups() as $group) {
70-
$this->addFilterGroupToCollection($group, $collection);
71-
}
72-
73-
/** @var SortOrder $sortOrder */
74-
$sortOrders = $searchCriteria->getSortOrders();
75-
if ($sortOrders) {
76-
foreach ($sortOrders as $sortOrder) {
77-
$collection->addOrder(
78-
$sortOrder->getField(),
79-
($sortOrder->getDirection() === SortOrder::SORT_ASC) ? SortOrder::SORT_ASC : SortOrder::SORT_DESC
80-
);
81-
}
82-
}
83-
84-
$collection->setCurPage($searchCriteria->getCurrentPage());
85-
$collection->setPageSize($searchCriteria->getPageSize());
75+
$this->collectionProcessor->process($searchCriteria, $collection);
8676

8777
$items = [];
8878
foreach ($collection->getAllIds() as $id) {
@@ -98,22 +88,18 @@ public function getList(SearchCriteriaInterface $searchCriteria)
9888
}
9989

10090
/**
101-
* Add filter group to collection
91+
* Retrieve collection processor
10292
*
103-
* @param FilterGroup $filterGroup
104-
* @param Collection $collection
105-
* @return void
93+
* @deprecated
94+
* @return CollectionProcessorInterface
10695
*/
107-
private function addFilterGroupToCollection(FilterGroup $filterGroup, Collection $collection)
96+
private function getCollectionProcessor()
10897
{
109-
$filters = $filterGroup->getFilters();
110-
if ($filters) {
111-
$fields = [];
112-
foreach ($filters as $filter) {
113-
$conditionType = $filter->getConditionType() ? $filter->getConditionType() : 'eq';
114-
$fields[] = ['attribute' => $filter->getField(), $conditionType => $filter->getValue()];
115-
}
116-
$collection->addFieldToFilter($fields);
98+
if (!$this->collectionProcessor) {
99+
$this->collectionProcessor = \Magento\Framework\App\ObjectManager::getInstance()->get(
100+
'Magento\Eav\Model\Api\SearchCriteria\CollectionProcessor'
101+
);
117102
}
103+
return $this->collectionProcessor;
118104
}
119105
}

0 commit comments

Comments
 (0)